public class Point2DPropertyType extends PropertyType<Point2D>
dk.heick.properties.types.custom.Point2D
value. java.awt.Point
or a java.awt.geom.Point2D.Double
.Constructor Example | Comments | ||
---|---|---|---|
Property<Point2D> A_PROPERTY = |
Creates Point2DPropertyType with no default value. | ||
Property<Point2D> A_PROPERTY = |
Creates Point2DPropertyType with a a default value . | ||
Type of value(s) | Examples | Result | Comments |
Valid | 3,4 | new Point2D(3,4) | Validate successfully. |
Valid | -3.453E-23,99.88 | new Point2D(-3.453E-23,99.88) | 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 | 555,33,44 | null |
Point2D
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of Point2D.
|
static char |
VALUE_SEPERATOR
The char which seperates the two double values.
|
Constructor and Description |
---|
Point2DPropertyType()
Default constructor, no default value.
|
Point2DPropertyType(double x,
double y)
Constructor with default x,y values.
|
Point2DPropertyType(Point2D defaultValue)
Constructor with default value.
|
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,
Point2D t)
Converts a typed to the string representation.
|
Point2D |
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 static final char VALUE_SEPERATOR
public Point2DPropertyType()
public Point2DPropertyType(Point2D defaultValue)
defaultValue
- defaultValue default value returned if property value is undefined.public Point2DPropertyType(double x, double y)
x
- default x value.y
- default y value.public List<String> getRestrictions()
PropertyType
getRestrictions
in class PropertyType<Point2D>
public Point2D validateValue(String propertyName, String value) throws PropertyException
PropertyType
validateValue
in class PropertyType<Point2D>
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 String toString(String propertyName, Point2D t) throws PropertyException
PropertyType
toString
in class PropertyType<Point2D>
propertyName
- the name of the property used for logging purposes.t
- the type T.PropertyException
- if conversion failed in validation.PropertyType.validate(String, String)