public class BolType extends BaseValueType<Boolean>
Boolean type.
This class is threadsafe and uses a singleton pattern to prevent multiple instances, since all users can safely share the same instance.
clazzType| Modifier | Constructor and Description |
|---|---|
protected |
BolType() |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
cast(Object o)
Attempt to cast the object to the generic type T, which is a concrete class in subclasses.
|
static BolType |
instance()
Fetch the single, shared instace of this ValueType
|
Boolean |
parse(String sourceValue)
Parses a String to a
Boolean. |
getDestinationType, toStringpublic static BolType instance()
BolType()public Boolean parse(String sourceValue) throws ParsingException
Boolean. The String should already be trimmed.
Returns True if the String matches one of the 'true-ish' values or
false if it matches one of the 'false-ish' values (case-insensitive).
Recognized True strings:
Recognized False strings:
ParsingException, null values
always return null. Values are assumed to be trimmed to null (if
appropriate from where they are loaded from) prior to being passed to this
method.
Note: The parsing behavior changed in the 0.5.0 release to have an explicit list of False values. See Issue 658.
sourceValue - The source string, which should already be trimmed and may be nullParsingException - If the value is not a recognized True or False string.public Boolean cast(Object o) throws RuntimeException
ValueTypeAndHow uses this internally to cast values known to already be of type T, but were stored in a generic way. If used for unknown types that are not castable to T, it will throw a RuntimeException, though this should never happen unless used by application code.
o - Object to castRuntimeExceptionCopyright © 2022. All rights reserved.