org.jboss.security.xacml.sunxacml.attr
Class DNSNameAttribute

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.attr.AttributeValue
      extended by org.jboss.security.xacml.sunxacml.attr.DNSNameAttribute
All Implemented Interfaces:
Evaluatable, Expression

public class DNSNameAttribute
extends AttributeValue

Represents the DNSName datatype introduced in XACML 2.0. All objects of this class are immutable and all methods of the class are thread-safe.

Since:
2.0
Author:
Seth Proctor

Field Summary
static String identifier
          Official name of this type
 
Constructor Summary
DNSNameAttribute(String hostname)
          Creates the new DNSNameAttribute with only the required hostname component.
DNSNameAttribute(String hostname, PortRange range)
          Creates the new DNSNameAttribute with the optional port range component.
 
Method Summary
 String encode()
          Encodes the value in a form suitable for including in XML data like a request or an obligation.
 boolean equals(Object o)
          Returns true if the input is an instance of this class and if its value equals the value contained in this class.
 String getHostName()
          Returns the host name represented by this object.
static DNSNameAttribute getInstance(Node root)
          Returns a new DNSNameAttribute that represents the name at a particular DOM node.
static DNSNameAttribute getInstance(String value)
          Returns a new DNSNameAttribute that represents the name indicated by the String provided.
 PortRange getPortRange()
          Returns the port range represented by this object which will be unbound if no range was specified.
 int hashCode()
          Returns the hashcode value used to index and compare this object with others of the same type.
 boolean isSubdomain()
          Returns true if the leading character in the hostname is a '*', and therefore represents a matching subdomain, or false otherwise.
 String toString()
          Converts to a String representation.
 
Methods inherited from class org.jboss.security.xacml.sunxacml.attr.AttributeValue
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag, returnsBag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

identifier

public static final String identifier
Official name of this type

See Also:
Constant Field Values
Constructor Detail

DNSNameAttribute

public DNSNameAttribute(String hostname)
                 throws ParsingException
Creates the new DNSNameAttribute with only the required hostname component.

Parameters:
hostname - the host name component of the address
Throws:
ParsingException - if the hostname is invalid

DNSNameAttribute

public DNSNameAttribute(String hostname,
                        PortRange range)
                 throws ParsingException
Creates the new DNSNameAttribute with the optional port range component.

Parameters:
hostname - the host name component of the address
range - the port range
Throws:
ParsingException - if the hostname is invalid
Method Detail

getInstance

public static DNSNameAttribute getInstance(Node root)
                                    throws ParsingException
Returns a new DNSNameAttribute that represents the name at a particular DOM node.

Parameters:
root - the Node that contains the desired value
Returns:
a new DNSNameAttribute representing the appropriate value (null if there is a parsing error)
Throws:
ParsingException - if the hostname is invalid

getInstance

public static DNSNameAttribute getInstance(String value)
                                    throws ParsingException
Returns a new DNSNameAttribute that represents the name indicated by the String provided.

Parameters:
value - a string representing the name
Returns:
a new DNSNameAttribute
Throws:
ParsingException - if the hostname is invalid

getHostName

public String getHostName()
Returns the host name represented by this object.

Returns:
the host name

getPortRange

public PortRange getPortRange()
Returns the port range represented by this object which will be unbound if no range was specified.

Returns:
the port range

isSubdomain

public boolean isSubdomain()
Returns true if the leading character in the hostname is a '*', and therefore represents a matching subdomain, or false otherwise.

Returns:
true if the name represents a subdomain, false otherwise

equals

public boolean equals(Object o)
Returns true if the input is an instance of this class and if its value equals the value contained in this class.

Overrides:
equals in class Object
Parameters:
o - the object to compare
Returns:
true if this object and the input represent the same value

hashCode

public int hashCode()
Returns the hashcode value used to index and compare this object with others of the same type.

Overrides:
hashCode in class Object
Returns:
the object's hashcode value

toString

public String toString()
Converts to a String representation.

Overrides:
toString in class Object
Returns:
the String representation

encode

public String encode()
Description copied from class: AttributeValue
Encodes the value in a form suitable for including in XML data like a request or an obligation. This must return a value that could in turn be used by the factory to create a new instance with the same value.

Specified by:
encode in class AttributeValue
Returns:
a String form of the value


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.