Class TimeValue
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.SimpleValue<V>
-
- org.ow2.authzforce.core.pdp.api.value.StringParseableValue<XMLGregorianCalendar>
-
- org.ow2.authzforce.core.pdp.api.value.BaseTimeValue<TimeValue>
-
- org.ow2.authzforce.core.pdp.api.value.TimeValue
-
- All Implemented Interfaces:
Comparable<TimeValue>
,AttributeValue
,PrimitiveValue
,Value
public final class TimeValue extends BaseTimeValue<TimeValue>
Representation of a xs:time value. This class supports parsing xs:time values. All objects of this class are immutable and thread-safe.The
XMLGregorianCalendar
returned bySimpleValue.getUnderlyingValue()
have the following characteristics:XMLGregorianCalendar.getYear()
always returnsDatatypeConstants.FIELD_UNDEFINED
XMLGregorianCalendar.getEon()
andXMLGregorianCalendar.getEonAndYear()
always return nullXMLGregorianCalendar.getMonth()
always returnsDatatypeConstants.FIELD_UNDEFINED
XMLGregorianCalendar.getDay()
always returnsDatatypeConstants.FIELD_UNDEFINED
XMLGregorianCalendar.getYear()
always returnsDatatypeConstants.FIELD_UNDEFINED
- Version:
- $Id: $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ow2.authzforce.core.pdp.api.value.StringParseableValue
StringParseableValue.Factory<AV extends AttributeValue>
-
Nested classes/interfaces inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
SimpleValue.BaseFactory<AV extends AttributeValue>
-
-
Field Summary
-
Fields inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
value
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeValue
add(DurationValue<?> durationVal)
Add duration to this timestatic TimeValue
getInstance(XMLGregorianCalendar timeCalendar)
Creates a new instance from a CalendarTimeValue
subtract(DurationValue<?> durationVal)
Subtract duration to this time-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.BaseTimeValue
compareTo, printXML
-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.StringParseableValue
getXmlAttributes
-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
equals, getContent, getUnderlyingValue, hashCode, toString
-
-
-
-
Constructor Detail
-
TimeValue
public TimeValue(String time) throws IllegalArgumentException
Creates a newTimeAttributeValue
from a string representation of time- Parameters:
time
- string representation of time- Throws:
IllegalArgumentException
- iftime
is not a valid string representation of xs:time
-
-
Method Detail
-
getInstance
public static TimeValue getInstance(XMLGregorianCalendar timeCalendar)
Creates a new instance from a Calendar- Parameters:
timeCalendar
- aXMLGregorianCalendar
object representing the specified time; beware that this method creates an internal copy oftimeCalendar
(to prevent modification oftimeCalendar
and any external modification of the created instance's internal copy) before unsetting all date fields (year, month, day): e.g. for the year,calendarCopy.setYear(DatatypeConstants.FIELD_UNDEFINED)
- Returns:
- new instance
- Throws:
IllegalArgumentException
- ifcalendar == null
-
add
public TimeValue add(DurationValue<?> durationVal)
Add duration to this time- Specified by:
add
in classBaseTimeValue<TimeValue>
- Parameters:
durationVal
- duration value- Returns:
- this + durationVal
-
subtract
public TimeValue subtract(DurationValue<?> durationVal)
Subtract duration to this time- Specified by:
subtract
in classBaseTimeValue<TimeValue>
- Parameters:
durationVal
- duration value- Returns:
- this - durationVal
-
-