org.opensaml.xml.schema
Class XSBooleanValue

java.lang.Object
  extended by org.opensaml.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
XSBooleanValue()
          Constructor.
XSBooleanValue(Boolean newValue, boolean numericRepresentation)
          Constructor.
 
Method Summary
 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
 

Constructor Detail

XSBooleanValue

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


XSBooleanValue

public XSBooleanValue(Boolean newValue,
                      boolean numericRepresentation)
Constructor.

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

getValue

public Boolean getValue()
Gets the boolean value.

Returns:
the boolean value

setValue

public void setValue(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(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


Copyright © 2006-2011 Internet2. All Rights Reserved.