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

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.attr.AttributeValue
      extended by org.jboss.security.xacml.sunxacml.attr.IPAddressAttribute
All Implemented Interfaces:
Evaluatable, Expression
Direct Known Subclasses:
IPv4AddressAttribute, IPv6AddressAttribute

public abstract class IPAddressAttribute
extends AttributeValue

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

To create an instance of an ipAddress from an encoded String or a DOM Node you should use the getInstance methods provided by this class. To construct an ipAddress instance directly, you must use the constructors provided by IPv4AddressAttribute and IPv6AddressAttribute. These will both create an attribute of XACML type ipAddress, but will handle the differences in these two representations correctly.

Since:
2.0
Author:
Seth Proctor

Field Summary
static String identifier
          Official name of this type
 
Constructor Summary
protected IPAddressAttribute(InetAddress address, InetAddress mask, PortRange range)
          Creates the new IPAddressAttribute with all the optional components.
 
Method Summary
 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.
 InetAddress getAddress()
          Returns the address represented by this object.
static IPAddressAttribute getInstance(Node root)
          Returns a new IPAddressAttribute that represents the name at a particular DOM node.
static IPAddressAttribute getInstance(String value)
          Returns a new IPAddressAttribute that represents the name indicated by the String provided.
 InetAddress getMask()
          Returns the mask represented by this object, or null if there is no mask.
 PortRange getRange()
          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.
 String toString()
          Converts to a String representation.
 
Methods inherited from class org.jboss.security.xacml.sunxacml.attr.AttributeValue
encode, 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

IPAddressAttribute

protected IPAddressAttribute(InetAddress address,
                             InetAddress mask,
                             PortRange range)
Creates the new IPAddressAttribute with all the optional components.

Parameters:
address - a non-null InetAddress
mask - an InetAddress or null if there is no mask
portRange - a non-null PortRange
Method Detail

getInstance

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

Parameters:
root - the Node that contains the desired value
Returns:
a new IPAddressAttribute representing the appropriate value (null if there is a parsing error)
Throws:
ParsingException - if any of the address components is invalid

getInstance

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

Parameters:
value - a string representing the address
Returns:
a new IPAddressAttribute
Throws:
ParsingException - if any of the address components is invalid

getAddress

public InetAddress getAddress()
Returns the address represented by this object.

Returns:
the address

getMask

public InetAddress getMask()
Returns the mask represented by this object, or null if there is no mask.

Returns:
the mask or null

getRange

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

Returns:
the range

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


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