Class BooleanValue
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.SimpleValue<V>
-
- org.ow2.authzforce.core.pdp.api.value.StringParseableValue<Boolean>
-
- org.ow2.authzforce.core.pdp.api.value.BooleanValue
-
- All Implemented Interfaces:
AttributeValue
,PrimitiveValue
,Value
public final class BooleanValue extends StringParseableValue<Boolean>
Representation of a xs:boolean value. This class supports parsing xs:boolean values. All objects of this class are immutable and all methods of the class are thread-safe. The choice of the Java type boolean 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 Modifier and Type Field Description static BooleanValue
FALSE
Single instance of BooleanAttributeValue that represents false.static BooleanValue
TRUE
Single instance of BooleanAttributeValue that represents true.-
Fields inherited from class org.ow2.authzforce.core.pdp.api.value.SimpleValue
value
-
-
Constructor Summary
Constructors Constructor Description BooleanValue(Boolean value)
Creates a newBooleanAttributeValue
that represents the boolean value supplied.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static BooleanValue
getInstance(String s)
Convert a boolean value from string, according to the XML Schema definition.net.sf.saxon.s9api.XdmItem
getXdmItem()
int
hashCode()
BooleanValue
not()
not(this)String
printXML()
Converts the internal value (accessible viaSimpleValue.getUnderlyingValue()
) to a valid lexical representation for XML marshalling.static BooleanValue
valueOf(boolean b)
GetTRUE
(resp.-
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
getContent, getUnderlyingValue, 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
-
-
-
-
Field Detail
-
TRUE
public static final BooleanValue TRUE
Single instance of BooleanAttributeValue that represents true. Initialized by the static initializer below.
-
FALSE
public static final BooleanValue FALSE
Single instance of BooleanAttributeValue that represents false. Initialized by the static initializer below.
-
-
Constructor Detail
-
BooleanValue
public BooleanValue(Boolean value)
Creates a newBooleanAttributeValue
that represents the boolean value supplied.This constructor is private because it should not be used by anyone other than the static initializer in this class. Instead, please use one of the getInstance methods, which will ensure that only two BooleanAttributeValue objects are created, thus avoiding excess object creation.
- Parameters:
value
- boolean value
-
-
Method Detail
-
getInstance
public static BooleanValue getInstance(String s) throws IllegalArgumentException
Convert a boolean value from string, according to the XML Schema definition. Adapted fromBooleanValue.fromString(CharSequence)
, but without whitespace trimming. This is meant to replaceDatatypeConverter.parseBoolean(String)
which is flawed and does not comply with XSD definition of boolean type as of now (JDK7/8). See https://java.net/jira/browse/JAXB-901, and https://java.net/jira/browse/JAXB-902. E.g. DatatypeConverter.parseBoolean("not") throws NullPointerException instead of IllegalArgumentException as expected according to javadoc.- Parameters:
s
- XSD-compliant string representation of boolean- Returns:
- boolean value corresponding to
s
- Throws:
IllegalArgumentException
- if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean.
-
valueOf
public static BooleanValue valueOf(boolean b)
- Parameters:
b
- boolean input- Returns:
- instance
-
not
public BooleanValue not()
not(this)- Returns:
!value
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSimpleValue<Boolean>
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classSimpleValue<Boolean>
-
printXML
public 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<Boolean>
- Returns:
- XML-valid lexical representation.
-
getXdmItem
public net.sf.saxon.s9api.XdmItem getXdmItem()
- Returns:
- corresponding XPath (XDM) value
-
-