Class SimpleValue<V>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.SimpleValue<V>
-
- Type Parameters:
V
- underlying Java value type
- All Implemented Interfaces:
AttributeValue
,PrimitiveValue
,Value
- Direct Known Subclasses:
StringParseableValue
,XPathValue
public abstract class SimpleValue<V> extends Object implements AttributeValue
Superclass of all "simple" Attribute Values, including values of any XACML standard datatype; "simple" as in "simple type" or "simple content" of XML schema. This means the value can be represented as character data only (String) with no sub-elements (no XML elements) - but with possibly extra XML attributes - as opposed to structured values that have sub-elements. In this definition, all XACML core standard primitive types are "simple" types, and their corresponding Java classes extend this class.- Version:
- $Id: $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimpleValue.BaseFactory<AV extends AttributeValue>
Datatype-specific Attribute Value Factory that supports values based on singleSerializable
element (i.e.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleValue(V rawVal)
Constructor from Java type of value.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
List<Serializable>
getContent()
Get the value content as specified byXmlMixed
, i.e.V
getUnderlyingValue()
Returns the internal low-level Java value on which this AttributeValue is based off.int
hashCode()
abstract String
printXML()
Converts the internal value (accessible viagetUnderlyingValue()
) to a valid lexical representation for XML marshalling.String
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.AttributeValue
getXmlAttributes
-
Methods inherited from interface org.ow2.authzforce.core.pdp.api.value.PrimitiveValue
getXdmItem, getXdmValue
-
-
-
-
Field Detail
-
value
protected final V value
-
-
Constructor Detail
-
SimpleValue
protected SimpleValue(V rawVal) throws IllegalArgumentException
Constructor from Java type of value. A Serializable JAXB-compatible form of the value must be provided to be used directly as first value ingetContent()
The super field 'content' is set to an empty list, but it does not matter, sincegetContent()
is overridden here to return a singleton list withrawVal
as single value.- Parameters:
rawVal
- internal Java native value. MUST NOT be null.- Throws:
IllegalArgumentException
- ifrawVal == null
-
-
Method Detail
-
getUnderlyingValue
public final V getUnderlyingValue()
Returns the internal low-level Java value on which this AttributeValue is based off. This method is provided mostly for convenience, especially for low-level operations. However, you should not use it unless there is no other way. Prefer the high-level methods provided by the concreteSimpleValue
implementation if you need to do operations on it.- Returns:
- the value
-
printXML
public abstract String printXML()
Converts the internal value (accessible viagetUnderlyingValue()
) 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 bygetContent()
and its result cached by the same method for later use. Therefore, no need to cache the result in the implementation.- Returns:
- XML-valid lexical representation.
-
getContent
public final List<Serializable> getContent()
Get the value content as specified byXmlMixed
, i.e. a list, each item of which may be a String, aJAXBElement
, an instance of a class annotated with @XmlRootElement, or aElement
. In addition, in the two latter cases, the item must also beSerializable
.- Specified by:
getContent
in interfaceAttributeValue
- Returns:
- (possibly mixed) content; not null (must be empty if no content)
-
-