Package org.opensaml.core.xml.schema
Class XSBooleanValue
- java.lang.Object
-
- org.opensaml.core.xml.schema.XSBooleanValue
-
public class XSBooleanValue extends Object
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.
-
-
Constructor Summary
Constructors Constructor Description XSBooleanValue()Constructor.XSBooleanValue(Boolean newValue, boolean numericRepresentation)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)BooleangetValue()Gets the boolean value.inthashCode()booleanisNumericRepresentation()Gets whether to use the numeric or lexical representation.voidsetNumericRepresentation(boolean numericRepresentation)Sets whether to use the numeric or lexical representation.voidsetValue(Boolean newValue)Sets the boolean value.StringtoString()static StringtoString(Boolean value, boolean numericRepresentation)Converts a boolean value into a string.static XSBooleanValuevalueOf(String booleanString)Parses a string meant to represent a boolean.
-
-
-
Field Detail
-
numeric
private boolean numeric
Whether to use the numeric representation of the lexical one.
-
value
private Boolean value
Value of this boolean.
-
-
Constructor Detail
-
XSBooleanValue
public XSBooleanValue()
Constructor. Uses lexical representation and sets value to null.
-
XSBooleanValue
public XSBooleanValue(@Nullable Boolean newValue, boolean numericRepresentation)Constructor.- Parameters:
newValue- the valuenumericRepresentation- whether to use a numeric or lexical representation
-
-
Method Detail
-
getValue
@Nullable public Boolean getValue()
Gets the boolean value.- Returns:
- the boolean value
-
setValue
public void setValue(@Nullable Boolean newValue)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
-
toString
public static String toString(Boolean value, boolean numericRepresentation)
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
public static XSBooleanValue valueOf(@Nullable String booleanString)
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
-
-