Package org.opensaml.core.xml.schema
Class XSBooleanValue
java.lang.Object
org.opensaml.core.xml.schema.XSBooleanValue
A class representing a boolean attribute. This class tracks the usage of the literals {true, false, 1, 0} to ensure
proper roundtripping when unmarshalling/marshalling.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.XSBooleanValue
(Boolean newValue, boolean numericRepresentation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getValue()
Gets the boolean value.int
hashCode()
boolean
Gets whether to use the numeric or lexical representation.void
setNumericRepresentation
(boolean numericRepresentation) Sets whether to use the numeric or lexical representation.void
Sets the boolean value.toString()
static String
Converts a boolean value into a string.static XSBooleanValue
Parses a string meant to represent a boolean.
-
Field Details
-
numeric
private boolean numericWhether to use the numeric representation of the lexical one. -
value
Value of this boolean.
-
-
Constructor Details
-
XSBooleanValue
public XSBooleanValue()Constructor. Uses lexical representation and sets value to null. -
XSBooleanValue
Constructor.- Parameters:
newValue
- the valuenumericRepresentation
- whether to use a numeric or lexical representation
-
-
Method Details
-
getValue
Gets the boolean value.- Returns:
- the boolean value
-
setValue
Sets the boolean value.- Parameters:
newValue
- the boolean value
-
isNumericRepresentation
public boolean isNumericRepresentation()Gets whether to use the numeric or lexical representation.- Returns:
- whether to use the numeric or lexical representation
-
setNumericRepresentation
public void setNumericRepresentation(boolean numericRepresentation) Sets whether to use the numeric or lexical representation.- Parameters:
numericRepresentation
- whether to use the numeric or lexical representation
-
hashCode
public int hashCode() -
equals
-
toString
-
toString
Converts a boolean value into a string. If using the numeric representations and the value is true then "1" is returned or "0" if the value is false. If lexical representation is used "true" and "false" will be returned. If the given value is null, then "false" is returned.- Parameters:
value
- the boolean valuenumericRepresentation
- whether to use numeric of lexical representation- Returns:
- the textual representation
-
valueOf
Parses a string meant to represent a boolean. If the string is "1" or "0" the returned object will use a numeric representation and have a value of TRUE or FALSE, respectively. If the string is "true" the returned object will use a lexical representation and have a value of TRUE. If the string is anything else the returned object will use a lexical representation and have a value of FALSE.- Parameters:
booleanString
- the string to parse- Returns:
- the boolean value
-