|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Transformer<K,L>
Transformer interface, which knows how to transform the original
data to some custom representation.
A Transformer implementation could be stateful or stateless. However
it's very easy to write stateful Transformer, which actaully doesn't
save any state internally, but uses AttributeStorage as an external
state storage. Please note, that AttributeStorage is being passed
as the parameter to all Transformer methods. This way it's
possible to reuse single instance of a stateful Transformer to
process lots of concurrent transformations.
| Method Summary | |
|---|---|
K |
getInput(AttributeStorage storage)
Gets the input data, which Transformer will work with. |
TransformationResult<L> |
getLastResult(AttributeStorage storage)
Gets the last returned Transformer result. |
L |
getOutput(AttributeStorage storage)
Gets the output, which Transformer will use for transformed data. |
AttributeHolder |
getProperties(AttributeStorage storage)
Gets the property storage, using which it's possible to read or update Transformer properties. |
void |
hibernate(AttributeStorage storage)
Method could be called by framework to let Transformer know, that transformation will be postponed and probably continued in separate Thread, so all resources, which are associated with the current Thread should be detached and stored internally or in the external storage. |
void |
release(AttributeStorage storage)
The Transformer has done its work and can release all associated resource. |
void |
setInput(AttributeStorage storage,
K input)
Sets the input data, which Transformer will work with. |
void |
setOutput(AttributeStorage storage,
L output)
Gets the output, which Transformer will use for transformed data. |
TransformationResult<L> |
transform(AttributeStorage storage)
Transforms an input data to some custom representation. |
TransformationResult<L> |
transform(AttributeStorage storage,
K input,
L output)
Transforms an input data to some custom representation. |
| Method Detail |
|---|
TransformationResult<L> transform(AttributeStorage storage)
throws TransformationException
AttributeStorage).
storage - the external state storage, where Transformer could
get/put a state.
TransformationResult
TransformationException
TransformationResult<L> transform(AttributeStorage storage,
K input,
L output)
throws TransformationException
storage - the external state storage, where Transformer
could retrieve or store its state.
TransformationResult
TransformationExceptionK getInput(AttributeStorage storage)
Buffer, where "reader" will read the data to. But note,
the returned Buffer should always represent READY data.In other words,
if there is no data to be transformed - the Buffer should have 0
remaining bytes.
storage - the external state storage, where Transformer
could retrieve or store its state.
void setInput(AttributeStorage storage,
K input)
Buffer will be used by "reader" to read the data to. But note,
the input Buffer should always represent READY data.In other words,
if there is no data to be transformed - the Buffer should have 0
remaining bytes.
input - Input datastorage - the external state storage, where Transformer
could retrieve or store its state.L getOutput(AttributeStorage storage)
TransformationResult.
storage - the external state storage, where Transformer
could retrieve or store its state.
void setOutput(AttributeStorage storage,
L output)
TransformationResult.
output - Outputstorage - the external state storage, where Transformer
could retrieve or store its state.TransformationResult<L> getLastResult(AttributeStorage storage)
storage - the external state storage, where Transformer
could retrieve or store its state.
AttributeHolder getProperties(AttributeStorage storage)
storage - the external state storage, where Transformer
could retrieve or store its state.
void hibernate(AttributeStorage storage)
storage - the external state storage, where Transformer
could retrieve or store its state.void release(AttributeStorage storage)
storage - the external state storage, where Transformer
could retrieve or store its state.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||