T
- the underlying data type of the valuespublic class UpdatableValueTypeImpl<T> extends ValueTypeImpl<T> implements UpdatableValueType<T>
UpdatableValueType
.ValueTypeImpl.BooleanScanner, ValueTypeImpl.DateScanner, ValueTypeImpl.DateTimeScanner, ValueTypeImpl.NameScanner, ValueTypeImpl.NumberScanner, ValueTypeImpl.TextScanner, ValueTypeImpl.TimeDomainScanner, ValueTypeImpl.TypeScanner
ValueType.StandardValueType
Modifier | Constructor and Description |
---|---|
|
UpdatableValueTypeImpl(String name,
boolean restricted,
String scannerClassOrKeyword,
Map<String,String> valuesAndDescriptions,
Surrogate surrogate)
Construct an
UpdatableValueType . |
protected |
UpdatableValueTypeImpl(ValueTypeImpl<T> valueType)
Construct an
UpdatableValueType . |
Modifier and Type | Method and Description |
---|---|
void |
addValue(T value,
String description)
Add a value to list of allowed values.
|
void |
applyUpdates()
Apply pending updates.
|
void |
deleteValue(T value)
Delete a value from the list of allowed values.
|
void |
destroy()
Destroy the value type.
|
UpdatableValueType<T> |
edit()
Return an
UpdatableValueType corresponding to this value type. |
String |
getName()
Return the name of the value 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.
|
void |
setName(String name)
Set the name of the value type.
|
protected void |
update()
Refresh state.
|
void |
updateValue(T value,
String description)
Update the description of the given allowed value.
|
check, getAccessMethods, getExternalRepresentation, getScanner, getStandardValueType, getType, getValues, isBuiltIn, isCompatible, isRestricted, scan, toString, toString, typeCheck
equals, getDatabase, getId, getSurrogate, hashCode, inConstruction, isValid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
check, getExternalRepresentation, getScanner, getStandardValueType, getType, getValues, isBuiltIn, isCompatible, isRestricted, scan, toString, typeCheck
getDatabase, getId, getSurrogate, inConstruction, isValid
protected UpdatableValueTypeImpl(ValueTypeImpl<T> valueType) throws T2DBException
UpdatableValueType
.
This constructor is meant for ValueTypeImpl.edit()
.valueType
- a value typeT2DBException
public UpdatableValueTypeImpl(String name, boolean restricted, String scannerClassOrKeyword, Map<String,String> valuesAndDescriptions, Surrogate surrogate) throws T2DBException
UpdatableValueType
.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
ValueTypeImpl
update
in class ValueTypeImpl<T>
T2DBException
public void applyUpdates() throws T2DBException
Updatable
Database.commit()
and
Database.rollback()
is the client's responsibility.applyUpdates
in interface Updatable
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 String getName()
ValueType
public void setName(String name) throws T2DBException
UpdatableValueType
setName
in interface UpdatableValueType<T>
name
- a stringT2DBException
public Set<T> getValues()
ValueType
public Map<T,String> getValueDescriptions()
ValueType
getValueDescriptions
in interface ValueType<T>
getValueDescriptions
in class ValueTypeImpl<T>
public void addValue(T value, String description) throws T2DBException
UpdatableValueType
addValue
in interface UpdatableValueType<T>
value
- a valuedescription
- the value's descriptionT2DBException
public void updateValue(T value, String description) throws T2DBException
UpdatableValueType
updateValue
in interface UpdatableValueType<T>
value
- an allowed valuedescription
- a stringT2DBException
public void deleteValue(T value) throws T2DBException
UpdatableValueType
deleteValue
in interface UpdatableValueType<T>
value
- the value to deleteT2DBException
public void destroy() throws T2DBException
UpdatableValueType
destroy
in interface UpdatableValueType<T>
T2DBException
Copyright © 2017. All rights reserved.