public abstract class AbstractDatatype<V> extends Object implements Datatype<V>
Datatype.Builtin, Datatype.Default
Constructor and Description |
---|
AbstractDatatype() |
Modifier and Type | Method and Description |
---|---|
Datatype.Builtin |
getBuiltin() |
String |
getDisplayString() |
String |
getString(V value)
Transforms a value supported by this datatype into a string representation.
|
protected Class<V> |
getValueType() |
boolean |
isHandlingJavaType(Class type) |
boolean |
isValid(V value) |
void |
setBuiltin(Datatype.Builtin builtin) |
String |
toString() |
V |
valueOf(String s)
Transforms a string representation into a value of the supported type.
|
public boolean isHandlingJavaType(Class type)
isHandlingJavaType
in interface Datatype<V>
true
if this datatype can handle values of the given Java type.public V valueOf(String s) throws InvalidValueException
Datatype
valueOf
in interface Datatype<V>
s
- The string representation of a value.null
if the string was null
or empty.InvalidValueException
- If the string couldn't be parsed.public Datatype.Builtin getBuiltin()
getBuiltin
in interface Datatype<V>
null
if this is a custom datatype.public void setBuiltin(Datatype.Builtin builtin)
public String getString(V value) throws InvalidValueException
Datatype
This method calls Datatype.isValid(Object)
before converting the value, it throws
an exception if validation fails.
getString
in interface Datatype<V>
value
- The value to transform.null
.InvalidValueException
public boolean isValid(V value)
public String getDisplayString()
getDisplayString
in interface Datatype<V>
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.