T
- the underlying data type of the attributepublic interface Attribute<T>
Chronicle
or of a Series
.
Its value does not vary over time. It is defined by a Property
and has a value.
An attribute is defined in an AttributeDefinition
.
Modifier and Type | Method and Description |
---|---|
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 . |
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.
|
<S> Attribute<S> |
typeCheck(Class<S> type)
Cast the attribute to the type specified.
|
Property<T> getProperty()
Property
.T get()
AttributeDefinition
, or the value set with
set(T)
or scan(java.lang.Object)
.String getDescription(boolean effective)
effective
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.effective
- if true fall back to description from definitionvoid setDescription(String description)
description
- a description for the current attribute valuevoid reset()
AttributeDefinition
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.
void set(T value) throws T2DBException
AttributeDefinition
, as enforced by
Property.check(Object)
. Setting the value to null has the same
effect as calling reset()
.value
- a value for the attributeT2DBException
void scan(Object value) throws T2DBException
Object
.
A null value is passed directly to 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
set(Object)
. In the second case it is scanned
by ValueType.scan(String)
before being passed to set(Object)
.value
- an object representing the new value of the attributeT2DBException
<S> Attribute<S> typeCheck(Class<S> type) throws T2DBException
type
- the underlying type requiredT2DBException
Copyright © 2017. All rights reserved.