public class CountryPropertyType extends PropertyType<Locale>
java.util.Locale. aLocale.getCountry().equals(bLocale.getCountry()). | 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 | DK | new Locale("da","DK") | Validate successfully. |
| Valid | us | new Locale("en","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.getAvailableLocales(),
Locale,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of ClassnamePropertyType.
|
| Constructor and Description |
|---|
CountryPropertyType()
Default constructor, with
null as default value. |
CountryPropertyType(Locale defaultValue)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String[] |
getAvailableCountries()
Get a list of all countries from "Locale.getAvailableLocales()" which is not empty.
|
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.
|
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
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, validateNullTypepublic static final String TYPE
public CountryPropertyType()
null as default value.public CountryPropertyType(Locale defaultValue)
defaultValue - default value returned if property value is undefined.public String toString(String propertyName, Locale t) throws PropertyException
PropertyTypetoString 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 void validateConstraints(String propertyName) throws PropertyException
PropertyTypevalidateConstraints in class PropertyType<Locale>propertyName - the name of the property used for logging purposes, to
identify the unique property which PropertyType has constraint
issues.PropertyException - if the constraints have invalid/conflicting values.Property.validate()public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<Locale>public Locale validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue 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.public static final String[] getAvailableCountries()
Locale.getAvailableLocales()