T
- Generic type, see ValueEngineerFactory.getType()
.public interface ValueEngineer<T>
persist
values and
read(List read)
values back from persistence. Implementations may
provide further functionality on values through aspects
.
The broker provided to methods of this interface and implemented aspects offers additional, specialized agents:
ReferenceTransformationAgent
for transforming reference containers to elementsReferenceTransformationAgent
Modifier and Type | Method and Description |
---|---|
T |
copy(T original)
Create a copy of the given value, i.e., it produces a new instance having the same contents.
|
<T> T |
getAspect(ValueEngineerAspectType<T> aspect)
Request an aspect of the given type.
|
T |
getEmpty()
Create an empty (initial) value.
|
boolean |
isEmpty(T value)
Check if the provided value is empty.
|
T |
read(List<Node> nodes)
Read the value.
|
List<Node> |
write(T value)
Persist the given value.
|
@NotNull List<Node> write(@NotNull T value)
value
- The value to write as list of nodes.read(List)
@Nullable T read(@NotNull List<Node> nodes)
If instances are language specific pay attention to inject the correct language in the returned instance. You
can obtain the language from ValueEngineerContext.getLanguage()
.
nodes
- The nodes representing a value.write(Object)
@Nullable T getEmpty()
null
if no special empty value treatment is
needed. If the returned value is not null
the following condition should hold:
isEmpty(getEmpty()) == true
If instances are language specific pay attention to inject the correct language in the returned instance. You
can obtain the language from ValueEngineerContext.getLanguage()
.
T
or null
.isEmpty(Object)
boolean isEmpty(@NotNull T value)
value
- Value to check.true
if the provided value is empty.getEmpty()
@NotNull T copy(@NotNull T original)
For mutable object the following condition should hold for a given original
and its copy
:
original != copy
For immutable objects (e.g. String
s) you may return the provided original itself.
If instances are language specific pay attention to inject the correct language in the returned instance. You
can obtain the language from ValueEngineerContext.getLanguage()
.
original
- The value to be copied.@Nullable <T> T getAspect(@NotNull ValueEngineerAspectType<T> aspect)
The following aspects may be provided by an engineer:
ReferenceContaining
, if the value may contain store element referencesMatchSupporting
, if the value supports indexing and searchingDifferenceComputing
, if the engineer provides means to compute differences between valuesValidationSupporting
, if the engineer provides means to validate valuesaspect
- The aspect requested.null
, if the requested aspect is not supported.ReferenceContaining
,
MatchSupporting
,
DifferenceComputing
,
ValidationSupporting
Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500