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.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`numeric`
Whether to use the numeric representation of the lexical one.
`private Boolean`
`value`
Value of this boolean.

## Constructor Summary

Constructors
Constructor
Description
`XSBooleanValue()`
Constructor.
`XSBooleanValue(Boolean newValue, boolean numericRepresentation)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
`Boolean`
`getValue()`
Gets the boolean value.
`int`
`hashCode()`
`boolean`
`isNumericRepresentation()`
Gets whether to use the numeric or lexical representation.
`void`
`setNumericRepresentation(boolean numericRepresentation)`
Sets whether to use the numeric or lexical representation.
`void`
`setValue(Boolean newValue)`
Sets the boolean value.
`String`
`toString()`
`static String`
`toString(Boolean value, boolean numericRepresentation)`
Converts a boolean value into a string.
`static XSBooleanValue`
`valueOf(String booleanString)`
Parses a string meant to represent a boolean.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### numeric

private boolean numeric
Whether to use the numeric representation of the lexical one.

### value

private Boolean value
Value of this boolean.

## Constructor Details

### XSBooleanValue

public XSBooleanValue()
Constructor. Uses lexical representation and sets value to null.

### XSBooleanValue

public XSBooleanValue(@Nullable Boolean newValue, boolean numericRepresentation)
Constructor.

Parameters:
  `newValue` - the value
  `numericRepresentation` - whether to use a numeric or lexical representation

## Method Details

### 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

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### 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 value
  `numericRepresentation` - 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