Class DateValue
- 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<DateValue>
-
- org.ow2.authzforce.core.pdp.api.value.DateValue
-
- All Implemented Interfaces:
Comparable<DateValue>
,AttributeValue
,PrimitiveValue
,Value
public final class DateValue extends BaseTimeValue<DateValue>
Representation of a xs:date value. This class supports parsing xs:date values. All objects of this class are immutable and thread-safe.- 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 DateValue
add(DurationValue<?> durationVal)
Add duration to this timestatic DateValue
getInstance(XMLGregorianCalendar calendar)
Creates a newDateAttributeValue
from a Calendarnet.sf.saxon.s9api.XdmItem
getXdmItem()
DateValue
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ow2.authzforce.core.pdp.api.value.PrimitiveValue
getXdmValue
-
-
-
-
Constructor Detail
-
DateValue
public DateValue(String date) throws IllegalArgumentException
Creates a newDateAttributeValue
from a string representation of date- Parameters:
date
- string representation of date- Throws:
IllegalArgumentException
- ifdate
is not a valid string representation of xs:date
-
-
Method Detail
-
getInstance
public static DateValue getInstance(XMLGregorianCalendar calendar) throws IllegalArgumentException
Creates a newDateAttributeValue
from a Calendar- Parameters:
calendar
- aXMLGregorianCalendar
object representing the specified date; beware this method creates an internal copy ofcalendar
(to prevent modification ofcalendar
and any external modification of the created instance's internal copy) before unsetting all time fields:calendarCopy.setTime(DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED)
- Returns:
- new instance
- Throws:
IllegalArgumentException
- ifcalendar == null
-
getXdmItem
public net.sf.saxon.s9api.XdmItem getXdmItem()
- Returns:
- corresponding XPath (XDM) value
-
add
public DateValue add(DurationValue<?> durationVal)
Add duration to this time- Specified by:
add
in classBaseTimeValue<DateValue>
- Parameters:
durationVal
- duration value- Returns:
- this + durationVal
-
subtract
public DateValue subtract(DurationValue<?> durationVal)
Subtract duration to this time- Specified by:
subtract
in classBaseTimeValue<DateValue>
- Parameters:
durationVal
- duration value- Returns:
- this - durationVal
-
-