Class BaseTimeValue<TAV extends BaseTimeValue<TAV>>
- 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<TAV>
-
- Type Parameters:
TAV
- type of result returned by arithmetic functions with this type of arguments:add(DurationValue)
,subtract(DurationValue)
, etc. Basically, we expect that arithmetic functions applied to this type T will return a result of the same type T.
- All Implemented Interfaces:
Comparable<TAV>
,AttributeValue
,PrimitiveValue
,Value
- Direct Known Subclasses:
DateTimeValue
,DateValue
,TimeValue
public abstract class BaseTimeValue<TAV extends BaseTimeValue<TAV>> extends StringParseableValue<XMLGregorianCalendar> implements Comparable<TAV>
Superclass of date/time attribute values, i.e. XML schema date/time values. The choice of the Java typeXMLGregorianCalendar
is based on JAXB schema-to-Java mapping spec: https://docs.oracle.com/javase/tutorial/jaxb/intro/bind.html- 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
-
-
Constructor Summary
Constructors Constructor Description BaseTimeValue(XMLGregorianCalendar val, QName xsdDatatypeQName)
Instantiate date/time attribute value
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TAV
add(DurationValue<?> durationVal)
Add duration to this timeint
compareTo(TAV o)
Compares internal date/time value (XMLGregorianCalendar
) to another, usingXMLGregorianCalendar.compare(XMLGregorianCalendar)
String
printXML()
Converts the internal value (accessible viaSimpleValue.getUnderlyingValue()
to a valid lexical representation for XML marshalling.abstract TAV
subtract(DurationValue<?> durationVal)
Subtract duration to this time-
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
-
BaseTimeValue
public BaseTimeValue(XMLGregorianCalendar val, QName xsdDatatypeQName) throws IllegalArgumentException
Instantiate date/time attribute value- Parameters:
val
- string representation of instance of this datatypexsdDatatypeQName
- Fully qualified name for the date/time W3C XML Schema 1.0 datatype.- Throws:
IllegalArgumentException
- ifdatatype == null || val == null
-
-
Method Detail
-
add
public abstract TAV add(DurationValue<?> durationVal)
Add duration to this time- Parameters:
durationVal
- duration value- Returns:
- this + durationVal
-
subtract
public abstract TAV subtract(DurationValue<?> durationVal)
Subtract duration to this time- Parameters:
durationVal
- duration value- Returns:
- this - durationVal
-
compareTo
public final int compareTo(TAV o) throws IllegalArgumentException
Compares internal date/time value (XMLGregorianCalendar
) to another, usingXMLGregorianCalendar.compare(XMLGregorianCalendar)
- Specified by:
compareTo
in interfaceComparable<TAV extends BaseTimeValue<TAV>>
- Throws:
IllegalArgumentException
-
printXML
public final String printXML()
Converts the internal value (accessible viaSimpleValue.getUnderlyingValue()
to a valid lexical representation for XML marshalling. Equivalent to the 'printMethod' in JAXB 'javaType' binding customizations. Implementations of this typically callDatatypeConverter
. This method is called bySimpleValue.getContent()
and its result cached by the same method for later use. Therefore, no need to cache the result in the implementation.- Specified by:
printXML
in classSimpleValue<XMLGregorianCalendar>
- Returns:
- XML-valid lexical representation.
-
-