public class LocalePropertyType extends PropertyType<Locale>
java.util.Locale
. Constructor Example | Comments | ||
---|---|---|---|
Property<Locale> A_PROPERTY = |
Creates LocalePropertyType with no default value. | ||
Property<Locale> A_PROPERTY = |
Creates LocalePropertyType with default value "Locale.ENGLISH". | ||
Type of value(s) | Examples | Result | Comments |
Valid | da_DK | new Locale("da","DK") | Validate successfully. |
Valid | us | new Locale("us") | Validate successfully. |
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 . |
Locale
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of ClassnamePropertyType.
|
Constructor and Description |
---|
LocalePropertyType()
Default constructor, with
null as default value. |
LocalePropertyType(Locale 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.
|
String |
toString(String propertyName,
Locale t)
Converts a typed to the string representation.
|
Locale |
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, toType, validate, validateConstraints, validateNullType
public static final String TYPE
public LocalePropertyType()
null
as default value.public LocalePropertyType(Locale defaultValue)
defaultValue
- default value returned if property value is undefined.public String toString(String propertyName, Locale t) throws PropertyException
PropertyType
toString
in class PropertyType<Locale>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)
public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<Locale>
public Locale validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<Locale>
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.