T
- the underlying data type of attributes having this propertypublic class PropertyImpl<T> extends DBObjectImpl implements Property<T>
Property
.Constructor and Description |
---|
PropertyImpl(String name,
ValueType<T> valueType,
boolean indexed,
Surrogate surrogate)
Construct a
Property . |
Modifier and Type | Method and Description |
---|---|
void |
check(T value)
Check the value for conformity with the
ValueType . |
UpdatableProperty<T> |
edit()
Return an
UpdatableProperty corresponding to this property. |
List<Chronicle> |
getChronicles(T value,
int maxSize)
Return a list of chronicles which have the given attribute value.
|
String |
getName()
Return the name of the property.
|
ValueType<T> |
getValueType()
Return the value type of the property.
|
boolean |
isIndexed()
Return true if the property has been defined as indexed.
|
T |
scan(String value)
Return an object of the underlying data type for this property
converted from a textual value.
|
String |
toString() |
<S> Property<S> |
typeCheck(Class<S> type)
Cast the property 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 void update()
public ValueType<T> getValueType()
Property
getValueType
in interface Property<T>
public UpdatableProperty<T> edit()
Property
UpdatableProperty
corresponding to this property.
Successfully getting an Updatable
object does not imply
that updates can be successfully applied.public boolean isIndexed()
Property
indexed, it is meaningful to search for chronicles using
Property.getChronicles(Object, int)
. To give an example,
imagine a very large database where chronicles represent persons, with two attributes:
country of residence and email address. You would not search for persons residing in the
USA, would you? The size of the result would be enormous. On the other hand finding persons with a given email
address would be fast.public String getName()
Property
public T scan(String value) throws T2DBException
Property
scan
in interface Property<T>
value
- a textual representation of the valueT2DBException
public void check(T value) throws T2DBException
Property
ValueType
.
An exception is thrown if the value does not conform.
A typical cause of failure is that the value is not in the list of values
allowed by a restricted value type.check
in interface Property<T>
value
- a value to checkT2DBException
public List<Chronicle> getChronicles(T value, int maxSize) throws T2DBException
Property
getChronicles
in interface Property<T>
value
- the value to matchmaxSize
- the maximum size of the result, 0 for no limitT2DBException
public <S> Property<S> typeCheck(Class<S> type) throws T2DBException
Property
typeCheck
in interface Property<T>
type
- the underlying type requiredT2DBException
Copyright © 2017. All rights reserved.