public class ClassnamePropertyType extends PropertyType<Class<?>>
java.lang.Class. | Constructor Example | Comments | ||
|---|---|---|---|
Property<Class<?>> A_PROPERTY = |
No default value, must not extend any class or implements any interfaces. | ||
Property<Class<?>> A_PROPERTY = |
No default value. Must extends class "A" and implement interface "I1" and "I2 | ||
Property<Class<?>> A_PROPERTY = |
Default value is class "D". Must extends class "A" and implement interface "I1" and "I2 | ||
| Type of value(s) | Examples | Result | Comments |
| Valid | dk.heick.properties.types.helpers.classname.B | Class of "dk.heick.properties.types.helpers.classname.B" | Validate successfully. |
| Valid | dk.heick.properties.types.helpers.classname.C | Class of "dk.heick.properties.types.helpers.classname.C" | Validate successfully. |
| Invalid | dk.heick.properties.types.helpers.classname.Idontexists | null |
Validate will throw an exception. The resulting value is null. |
| Invalid | null |
defaultValue OR null |
Validate will throw an exception. Return default value if set, otherwise null. |
Class.forName(String),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of ClassnamePropertyType.
|
| Constructor and Description |
|---|
ClassnamePropertyType()
Default constructor.
|
ClassnamePropertyType(Class<?> defaultValue)
Constructor with default value.
|
ClassnamePropertyType(Class<?> defaultValue,
Class<?> mustExtend)
Constructor with default value and class extends.
|
ClassnamePropertyType(Class<?> defaultValue,
Class<?> mustExtend,
Class<?> mustImplement)
Constructor with default value class extends and one class implementation.
|
ClassnamePropertyType(Class<?> defaultValue,
Class<?> mustExtend,
Class<?>[] mustImplements)
Constructor with default value class extends and one class implementations.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getMustExtend()
The class which the property value must extend.
|
Class<?>[] |
getMustImplement()
The interfaces which the property value must implement.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
void |
setMustExtend(Class<?> mustExtend) |
void |
setMustImplement(Class<?>[] mustImplement) |
String |
toString(String propertyName,
Class<?> t)
Converts a typed to the string representation.
|
Class<?> |
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, validateNullTypepublic static final String TYPE
public ClassnamePropertyType()
public ClassnamePropertyType(Class<?> defaultValue)
defaultValue - the class returned if the property value is not valid.public ClassnamePropertyType(Class<?> defaultValue, Class<?> mustExtend)
defaultValue - default value returned if property value is undefined.mustExtend - the property value must extends this class.public ClassnamePropertyType(Class<?> defaultValue, Class<?> mustExtend, Class<?> mustImplement)
defaultValue - default value returned if property value is undefined.mustExtend - the property value must extends this class.mustImplement - the property value must implement this interface.public ClassnamePropertyType(Class<?> defaultValue, Class<?> mustExtend, Class<?>[] mustImplements)
defaultValue - default value returned if property value is undefined.mustExtend - the property value must extends this class.mustImplements - the property value must implement these interfaces.public Class<?> getMustExtend()
null is returned.public void setMustExtend(Class<?> mustExtend)
public Class<?>[] getMustImplement()
public String toString(String propertyName, Class<?> t) throws PropertyException
PropertyTypetoString in class PropertyType<Class<?>>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 setMustImplement(Class<?>[] mustImplement)
public Class<?> validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<Class<?>>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()
PropertyTypegetRestrictions in class PropertyType<Class<?>>