de.espirit.firstspirit.client.access.editor
Interface ValueEngineer<T>

Type Parameters:
T - Generic type, see ValueEngineerFactory.getType().

public interface ValueEngineer<T>

Engineer operating on values. Used to persist values and ValueEngineer.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:

Since:
4.2.414
See Also:
ReferenceTransformationAgent

Method Summary
 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.
 

Method Detail

write

@NotNull
List<Node> write(@NotNull
                         T value)
Persist the given value.

Parameters:
value - The value to write as list of nodes.
Returns:
A list of nodes representing the given value.
Since:
4.2.414
See Also:
ValueEngineer.read(List)

read

@Nullable
T read(@NotNull
                List<Node> nodes)
Read the value.

If instances are language specific pay attention to inject the correct language in the returned instance. You can obtain the language from ValueEngineerContext.getLanguage().

Parameters:
nodes - The nodes representing a value.
Returns:
The read value.
Since:
4.2.414
See Also:
ValueEngineer.write(Object)

getEmpty

@Nullable
T getEmpty()
Create an empty (initial) value. Implementors may return 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().

Returns:
An empty instance of type T or null.
Since:
4.2.414
See Also:
ValueEngineer.isEmpty(Object)

isEmpty

boolean isEmpty(@NotNull
                T value)
Check if the provided value is empty.

Parameters:
value - Value to check.
Returns:
true if the provided value is empty.
Since:
4.2.414
See Also:
ValueEngineer.getEmpty()

copy

@NotNull
T copy(@NotNull
               T original)
Create a copy of the given value, i.e., it produces a new instance having the same contents. Changing the original instance should have no effect on the copy.

For mutable object the following condition should hold for a given original and its copy:
original != copy
For immutable objects (e.g. Strings) 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().

Parameters:
original - The value to be copied.
Returns:
A clone of the value.
Since:
4.2.414

getAspect

@Nullable
<T> T getAspect(@NotNull
                         ValueEngineerAspectType<T> aspect)
Request an aspect of the given type.

The following aspects may be provided by an engineer:

Parameters:
aspect - The aspect requested.
Returns:
The according aspect providing instance or null, if the requested aspect is not supported.
Since:
4.2.414
See Also:
ReferenceContaining, MatchSupporting, DifferenceComputing, ValidationSupporting


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480