| Constructor and Description |
|---|
AttributeImpl(AttributeDefinitionImpl<T> attributeDefinition)
Construct an
Attribute. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
T |
get()
Return the attribute's value.
|
String |
getDescription(boolean effective)
Return the description of the attribute's value.
|
Property<T> |
getProperty()
Return the attribute's
Property. |
int |
hashCode() |
void |
reset()
Reset the default value of the attribute.
|
void |
scan(Object value)
Set the value of the attribute from an
Object. |
void |
set(T value)
Set the value of the attribute.
|
void |
setDescription(String description)
Set the description of the current attribute value.
|
String |
toString() |
<S> Attribute<S> |
typeCheck(Class<S> type)
Cast the attribute to the type specified.
|
public AttributeImpl(AttributeDefinitionImpl<T> attributeDefinition)
Attribute.attributeDefinition - an attribute definitionpublic Property<T> getProperty()
AttributeProperty.getProperty in interface Attribute<T>public T get()
AttributeAttributeDefinition, or the value set with
Attribute.set(T) or Attribute.scan(java.lang.Object).public void reset()
AttributeAttributeDefinition
will apply.
Note
When an attribute value happens to be equal to the default value but should not change when the default is updated, it must be set explicitly.
public void set(T value) throws T2DBException
AttributeAttributeDefinition, as enforced by
Property.check(Object). Setting the value to null has the same
effect as calling Attribute.reset().set in interface Attribute<T>value - a value for the attributeT2DBExceptionpublic void scan(Object value) throws T2DBException
AttributeObject.
A null value is passed directly to Attribute.set(Object).
When not null, the value either must be assignment
compatible with the underlying type of the attribute or it must be a
string. In the first case it is cast and passed to
Attribute.set(Object). In the second case it is scanned
by ValueType.scan(String) before being passed to Attribute.set(Object).scan in interface Attribute<T>value - an object representing the new value of the attributeT2DBExceptionpublic String getDescription(boolean effective)
Attributeeffective
parameter is set, and there is no description, and the attribute value is from a
value list, return the description from the value list, if any.getDescription in interface Attribute<T>effective - if true fall back to description from definitionpublic void setDescription(String description)
AttributesetDescription in interface Attribute<T>description - a description for the current attribute valuepublic <S> Attribute<S> typeCheck(Class<S> type) throws T2DBException
AttributetypeCheck in interface Attribute<T>type - the underlying type requiredT2DBExceptionCopyright © 2017. All rights reserved.