T
- the underlying data type of the valuespublic class ValueTypeImpl<T> extends DBObjectImpl implements ValueType<T>
ValueType
.
In agreement with the convention mentioned in the ValueScanner
class comment, the value type is passed to value scanner constructors
when such constructors are available.Modifier and Type | Class and Description |
---|---|
static class |
ValueTypeImpl.BooleanScanner
A value scanner for boolean data.
|
static class |
ValueTypeImpl.DateScanner
A value scanner for data representing
Day s. |
static class |
ValueTypeImpl.DateTimeScanner
A value scanner for data representing
DateTime s. |
static class |
ValueTypeImpl.NameScanner
A value scanner for textual data representing simple names.
|
static class |
ValueTypeImpl.NumberScanner
A value scanner for numeric data.
|
static class |
ValueTypeImpl.TextScanner
A value scanner for textual data.
|
static class |
ValueTypeImpl.TimeDomainScanner
A value scanner for data representing
TimeDomain s. |
static class |
ValueTypeImpl.TypeScanner
A value scanner for data representing
ValueType s. |
ValueType.StandardValueType
Modifier | Constructor and Description |
---|---|
|
ValueTypeImpl(String name,
boolean restricted,
String scannerClassOrKeyword,
Map<String,String> valuesAndDescriptions,
Surrogate surrogate)
Construct a
ValueType . |
protected |
ValueTypeImpl(ValueTypeImpl<T> valueType)
This constructor is intended for
UpdatableValueTypeImpl when implementing
the edit() method. |
Modifier and Type | Method and Description |
---|---|
void |
check(T value)
Check that the value is allowed.
|
UpdatableValueType<T> |
edit()
Return an
UpdatableValueType corresponding to this value type. |
<S> ValueAccessMethods<T> |
getAccessMethods()
Return the value access methods object for this type.
|
String |
getExternalRepresentation()
Return a string providing an external representation of the value type.
|
String |
getName()
Return the name of the value type.
|
ValueScanner<T> |
getScanner()
Return the value scanner.
|
ValueType.StandardValueType |
getStandardValueType()
Return the constant representing the value type when it is a built-in value type.
|
Class<T> |
getType()
Return the class of the underlying data type.
|
Map<T,String> |
getValueDescriptions()
Return a map with allowed values as keys and a description for each
value.
|
Set<T> |
getValues()
Return the set of allowed values.
|
Collection<String> |
getValues(String format)
Return values and descriptions as a collection of formatted strings.
|
boolean |
isBuiltIn()
Deprecated.
|
boolean |
isCompatible(Object obj)
Returns true if the object can be assigned to a variable of the
underlying data type.
|
boolean |
isRestricted()
Return true if the value type maintains an exhaustive list of allowed values.
|
T |
scan(String value)
Convert the argument to an object of the underlying data type.
|
String |
toString() |
String |
toString(Object value)
Convert the argument to a string.
|
<S> ValueType<S> |
typeCheck(Class<S> type)
Cast the value type to the type specified.
|
protected void |
update()
Refresh state.
|
equals, getDatabase, getId, getSurrogate, hashCode, inConstruction, isValid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDatabase, getId, getSurrogate, inConstruction, isValid
protected ValueTypeImpl(ValueTypeImpl<T> valueType) throws T2DBException
UpdatableValueTypeImpl
when implementing
the edit()
method.valueType
- T2DBException
public ValueTypeImpl(String name, boolean restricted, String scannerClassOrKeyword, Map<String,String> valuesAndDescriptions, Surrogate surrogate) throws T2DBException
ValueType
.name
- a stringrestricted
- if true the value type will keep a list of allowed valuesscannerClassOrKeyword
- a keyword identifying a standard value type of the name of a scanner classvaluesAndDescriptions
- a map of allowed values (as strings) and their descriptionsurrogate
- a surrogateT2DBException
protected void update() throws T2DBException
T2DBException
public UpdatableValueType<T> edit()
ValueType
UpdatableValueType
corresponding to this value type.
Successfully getting an Updatable
object does not imply
that updates can be successfully applied.public <S> ValueAccessMethods<T> getAccessMethods() throws T2DBException
T2DBException
public String getName()
ValueType
public boolean isRestricted()
ValueType
isRestricted
in interface ValueType<T>
@Deprecated public boolean isBuiltIn()
ValueType
public Class<T> getType()
ValueType
public ValueScanner<T> getScanner()
ValueType
getScanner
in interface ValueType<T>
public Set<T> getValues()
ValueType
public Map<T,String> getValueDescriptions()
ValueType
getValueDescriptions
in interface ValueType<T>
public boolean isCompatible(Object obj)
ValueType
ValueType.check(T)
for that.isCompatible
in interface ValueType<T>
obj
- an objectpublic T scan(String value) throws T2DBException
ValueType
scan
in interface ValueType<T>
value
- a stringT2DBException
public void check(T value) throws T2DBException
ValueType
check
in interface ValueType<T>
value
- a valueT2DBException
public String toString(Object value) throws T2DBException
ValueType
toString
in interface ValueType<T>
value
- a valueT2DBException
public Collection<String> getValues(String format)
ValueType
public String getExternalRepresentation()
ValueType
getExternalRepresentation
in interface ValueType<T>
public ValueType.StandardValueType getStandardValueType()
ValueType
getStandardValueType
in interface ValueType<T>
public <S> ValueType<S> typeCheck(Class<S> type) throws T2DBException
ValueType
typeCheck
in interface ValueType<T>
type
- the underlying type requiredT2DBException
Copyright © 2017. All rights reserved.