JBoss port of sunxacml 2.0.5-redhat-1

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

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.attr.PortRange

public class PortRange
extends Object

This class represents a port range as specified in the XACML 2.0 description of dnsName and ipAddress. The range may have upper and lower bounds, be specified by a single port number, or may be unbound.

Since:
2.0
Author:
Seth Proctor

Field Summary
static int UNBOUND
          Constant used to specify that the range is unbound on one side.
 
Constructor Summary
PortRange()
          Default constructor used to represent an unbound range.
PortRange(int singlePort)
          Creates a PortRange that represents a single port value instead of a range of values.
PortRange(int lowerBound, int upperBound)
          Creates a PortRange with upper and lower bounds.
 
Method Summary
 String encode()
           
 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.
static PortRange getInstance(String value)
          Creates an instance of PortRange based on the given value.
 int getLowerBound()
          Returns the lower-bound port value.
 int getUpperBound()
          Returns the upper-bound port value.
 boolean isLowerBounded()
          Returns whether the range is bounded by a lower port number.
 boolean isSinglePort()
          Returns whether the range is actually a single port number.
 boolean isUnbound()
          Returns whether the range is unbound, which means that it specifies no port number or range.
 boolean isUpperBounded()
          Returns whether the range is bounded by an upper port number.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNBOUND

public static final int UNBOUND
Constant used to specify that the range is unbound on one side.

See Also:
Constant Field Values
Constructor Detail

PortRange

public PortRange()
Default constructor used to represent an unbound range. This is typically used when an address has no port information.


PortRange

public PortRange(int singlePort)
Creates a PortRange that represents a single port value instead of a range of values.

Parameters:
singlePort - the single port number

PortRange

public PortRange(int lowerBound,
                 int upperBound)
Creates a PortRange with upper and lower bounds. Either of the parameters may have the value UNBOUND meaning that there is no bound at the respective end.

Parameters:
lowerBound - the lower-bound port number or UNBOUND
upperBound - the upper-bound port number or UNBOUND
Method Detail

getInstance

public static PortRange getInstance(String value)
Creates an instance of PortRange based on the given value.

Parameters:
value - a String representing the range
Returns:
a new PortRange
Throws:
NumberFormatException - if a port value isn't an integer

getLowerBound

public int getLowerBound()
Returns the lower-bound port value. If the range is not lower-bound, then this returns UNBOUND. If the range is actually a single port number, then this returns the same value as getUpperBound.

Returns:
the upper-bound

getUpperBound

public int getUpperBound()
Returns the upper-bound port value. If the range is not upper-bound, then this returns UNBOUND. If the range is actually a single port number, then this returns the same value as getLowerBound.

Returns:
the upper-bound

isLowerBounded

public boolean isLowerBounded()
Returns whether the range is bounded by a lower port number.

Returns:
true if lower-bounded, false otherwise

isUpperBounded

public boolean isUpperBounded()
Returns whether the range is bounded by an upper port number.

Returns:
true if upper-bounded, false otherwise

isSinglePort

public boolean isSinglePort()
Returns whether the range is actually a single port number.

Returns:
true if the range is a single port number, false otherwise

isUnbound

public boolean isUnbound()
Returns whether the range is unbound, which means that it specifies no port number or range. This is typically used with addresses that include no port information.

Returns:
true if the range is unbound, 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

encode

public String encode()

JBoss port of sunxacml 2.0.5-redhat-1

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