public final class Boolean extends Type
Modifier and Type | Field and Description |
---|---|
static Boolean |
SINGLETON
The only instance of this class.
|
Modifier and Type | Method and Description |
---|---|
static Boolean |
fromStringForOptional(String string)
Converts the specified string value to a
java.lang.Boolean
value. |
static boolean |
fromStringForRequired(String string)
Converts the specified non-
null string value to a
boolean . |
protected Object |
fromStringImpl(String string)
Converts from a
String to an instance of the value class
for this type (implementation method). |
String |
getDescription()
Retrieves the description of this type.
|
protected boolean |
isValidValueImpl(String string)
Determines if the specified
String value is considered
valid for this type (implementation method). |
static String |
toString(boolean value)
Converts the specified
boolean to a string. |
static String |
toString(Boolean value)
Converts the specified
Boolean to a string. |
String |
toString(Object value)
Generates a string representation of the specified value for this type.
|
checkValue, fromString, getName, getValueClass, isValidValue, toString
public static final Boolean SINGLETON
null
.public static boolean fromStringForRequired(String string) throws IllegalArgumentException, TypeValueException
null
string value to a
boolean
.string
- the string to convert, cannot be null
.boolean
value.IllegalArgumentException
- if string == null
.TypeValueException
- if the specified string does not represent a valid value for this
type.public static Boolean fromStringForOptional(String string) throws TypeValueException
java.lang.Boolean
value.string
- the string to convert, can be null
.Boolean
, or null
if
string == null
.TypeValueException
- if the specified string does not represent a valid value for this
type.public static String toString(Boolean value)
Boolean
to a string.value
- the value to convert, can be null
.null
if and
only if value == null
.public static String toString(boolean value)
boolean
to a string.value
- the value to convert.null
.protected boolean isValidValueImpl(String string)
String
value is considered
valid for this type (implementation method).
This method is called from Type.isValidValue(String)
. When
called from that method, it is guaranteed that the argument is not
null
.
isValidValueImpl
in class Type
string
- the String
value that should be checked for validity,
never null
.true
if and only if the specified String
value is valid, false
otherwise.protected Object fromStringImpl(String string) throws TypeValueException
String
to an instance of the value class
for this type (implementation method).
This method is not required to check the validity of the specified
value (since isValidValueImpl(String)
should have been called
before) but if it does, then it may throw a TypeValueException
.
fromStringImpl
in class Type
string
- the string to convert to an instance of the value class, guaranteed
to be not null
and guaranteed to have been passed to
isValidValueImpl(String)
without getting an exception.null
.TypeValueException
- if string
is considered to be an invalid value for this
type.public String toString(Object value) throws IllegalArgumentException, ClassCastException, TypeValueException
Type.getValueClass()
). Also, it may have to fall within a
certain range of valid values, depending on the type.toString
in class Type
value
- the value, cannot be null
.null
.IllegalArgumentException
- if value == null
.ClassCastException
- if getValueClass().isInstance(value) == false
.TypeValueException
- if the specified value is not in the allowed range.public String getDescription()
Type
getDescription
in class Type
null
.See http://www.xins.org/.