SunTM's XACML Implementation for JavaTM

com.sun.xacml.attr
Class DayTimeDurationAttribute

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeValue
      extended bycom.sun.xacml.attr.DayTimeDurationAttribute
All Implemented Interfaces:
Evaluatable

public class DayTimeDurationAttribute
extends AttributeValue

Representation of an xf:dayTimeDuration value. This class supports parsing xd:dayTimeDuration values. All objects of this class are immutable and thread-safe. The Date objects returned are not, but these objects are cloned before being returned.

Since:
1.0

Field Summary
static String identifier
          Official name of this type
 
Constructor Summary
DayTimeDurationAttribute(boolean negative, long days, long hours, long minutes, long seconds, int nanoseconds)
          Creates a new DayTimeDurationAttribute that represents the duration supplied.
 
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.
 long getDays()
          Gets the number of days.
 long getHours()
          Gets the number of hours.
static DayTimeDurationAttribute getInstance(Node root)
          Returns a new DayTimeDurationAttribute that represents the xf:dayTimeDuration at a particular DOM node.
static DayTimeDurationAttribute getInstance(String value)
          Returns a new DayTimeDurationAttribute that represents the xf:dayTimeDuration value indicated by the string provided.
 long getMinutes()
          Gets the number of minutes.
 int getNanoseconds()
          Gets the number of nanoseconds.
 long getSeconds()
          Gets the number of seconds.
 long getTotalSeconds()
          Gets the total number of round seconds (in milliseconds).
 int hashCode()
          Returns the hashcode value used to index and compare this object with others of the same type.
 boolean isNegative()
          Returns true if the duration is negative.
 String toString()
          Converts to a String representation.
 
Methods inherited from class com.sun.xacml.attr.AttributeValue
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType, isBag
 
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

DayTimeDurationAttribute

public DayTimeDurationAttribute(boolean negative,
                                long days,
                                long hours,
                                long minutes,
                                long seconds,
                                int nanoseconds)
                         throws IllegalArgumentException
Creates a new DayTimeDurationAttribute that represents the duration supplied.

Parameters:
negative - true if the duration is negative, false otherwise
days - the number of days in the duration
hours - the number of hours in the duration
minutes - the number of minutes in the duration
seconds - the number of seconds in the duration
nanoseconds - the number of nanoseconds in the duration
Throws:
IllegalArgumentException - if the total number of milliseconds exceeds Long.MAX_LONG
Method Detail

getInstance

public static DayTimeDurationAttribute getInstance(Node root)
                                            throws ParsingException,
                                                   NumberFormatException
Returns a new DayTimeDurationAttribute that represents the xf:dayTimeDuration at a particular DOM node.

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

getInstance

public static DayTimeDurationAttribute getInstance(String value)
                                            throws ParsingException,
                                                   NumberFormatException
Returns a new DayTimeDurationAttribute that represents the xf:dayTimeDuration value indicated by the string provided.

Parameters:
value - a string representing the desired value
Returns:
a new DayTimeDurationAttribute representing the desired value (null if there is a parsing error)
Throws:
ParsingException
NumberFormatException

isNegative

public boolean isNegative()
Returns true if the duration is negative.

Returns:
true if the duration is negative, false otherwise

getDays

public long getDays()
Gets the number of days.

Returns:
the number of days

getHours

public long getHours()
Gets the number of hours.

Returns:
the number of hours

getMinutes

public long getMinutes()
Gets the number of minutes.

Returns:
the number of minutes

getSeconds

public long getSeconds()
Gets the number of seconds.

Returns:
the number of seconds

getNanoseconds

public int getNanoseconds()
Gets the number of nanoseconds.

Returns:
the number of nanoseconds

getTotalSeconds

public long getTotalSeconds()
Gets the total number of round seconds (in milliseconds).

Returns:
the total number of seconds (in milliseconds)

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.

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. Typically this is the hashcode of the backing data object.

Returns:
the object's hashcode value

toString

public String toString()
Converts to a String representation.

Returns:
the String representation

encode

public String encode()
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

Sun's XACML Implementation Version 1.2

Copyright 2003-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.