public class BooleanPropertyType extends PropertyType<Boolean>
java.lang.Boolean
. Constructor Example | Comments | ||
---|---|---|---|
Property<Boolean> A_PROPERTY = new Property<Boolean>("name", new BooleanPropertyType()); |
Default value is null . |
||
Property<Boolean> A_PROPERTY = new Property<Boolean>("name", new BooleanPropertyType(true)); |
Default value is true . |
||
Type of value(s) | Examples | Result | Comments |
Valid | true | true | Validate successfully. The string value is trimmed and lower cased before conversion. |
Valid | t | true | |
Valid | on | true | |
Valid | yes | true | |
Valid | false | false | |
Valid | f | false | |
Valid | off | false | |
Valid | no | false | |
Invalid | cow | null |
Validate will throw an exception. The resulting value is null . |
Invalid | «empty string» | null |
|
Invalid | «empty string after trim» | null |
|
Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null . |
Boolean
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of BooleanPropertyType.
|
Constructor and Description |
---|
BooleanPropertyType()
Constructor, sets the default value to
null . |
BooleanPropertyType(Boolean defaultValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
Boolean |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateConstraints, validateNullType
public static final String TYPE
public BooleanPropertyType()
null
.public BooleanPropertyType(Boolean defaultValue)
defaultValue
- default value returned if property value is undefined.public Boolean validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<Boolean>
propertyName
- the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value
- the string representation of the propertyPropertyException
- if the conversion failed.public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<Boolean>