Class 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: $
    • 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 in getContent() The super field 'content' is set to an empty list, but it does not matter, since getContent() is overridden here to return a singleton list with rawVal as single value.
        Parameters:
        rawVal - internal Java native value. MUST NOT be null.
        Throws:
        IllegalArgumentException - if rawVal == 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 concrete SimpleValue implementation if you need to do operations on it.
        Returns:
        the value
      • printXML

        public abstract String printXML()
        Converts the internal value (accessible via getUnderlyingValue()) to a valid lexical representation for XML marshalling. Equivalent to the 'printMethod' in JAXB 'javaType' binding customizations. Implementations of this typically call DatatypeConverter. This method is called by getContent() 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 by XmlMixed, i.e. a list, each item of which may be a String, a JAXBElement, an instance of a class annotated with @XmlRootElement, or a Element. In addition, in the two latter cases, the item must also be Serializable.
        Specified by:
        getContent in interface AttributeValue
        Returns:
        (possibly mixed) content; not null (must be empty if no content)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object