public class CharsetPropertyType extends PropertyType<Charset>
java.nio.charset.Charset, but remember it validates against the charsets that the VM knows.| Constructor Example | Comments | ||
|---|---|---|---|
Property<Charset> A_PROPERTY = |
Creates CharsetPropertyType with no default value. | ||
Property<Charset> A_PROPERTY = new Property<Charset>("name", new CharsetPropertyType(Charset.forName("ISO-8859-1"))); |
Default value is Charset.forName("ISO-8859-1"). |
||
| Type of value(s) | Examples | Result | Comments |
| Valid | ISO-8859-1 | Charset.forName("ISO-8859-1") | Validate successfully. |
| Valid | UTF-16 | new Charset.forName("UTF-16") | 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. |
Charset,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of CharsetPropertyType.
|
| Constructor and Description |
|---|
CharsetPropertyType()
Constructor, sets the default value to
null. |
CharsetPropertyType(Charset defaultValue)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String[] |
getAvailableCharsetNames()
Available Charset names supported by VM instance.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
Charset |
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, validateNullTypepublic static final String TYPE
public CharsetPropertyType()
null.public CharsetPropertyType(Charset defaultValue)
defaultValue - default value returned if property value is undefined.public List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<Charset>public Charset validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<Charset>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 String[] getAvailableCharsetNames()