KeyIn
- type of key used in the KeyValueSource
ValueIn
- type of value used in the KeyValueSource
KeyOut
- key type for mapped resultsValueOut
- value type for mapped results@Beta public interface LifecycleMapper<KeyIn,ValueIn,KeyOut,ValueOut> extends Mapper<KeyIn,ValueIn,KeyOut,ValueOut>
The LifecycleMapper interface is a more sophisticated version of Mapper
normally used for complexer
algorithms with a need of initialization and finalization.
The behavior is the same as for Mapper
but initialize(Context)
is called before calling
Mapper.map(Object, Object, Context)
for the first time to prepare the mapper instance and maybe already
emit some values. After all mapping calls are finished finalized(Context)
is called and here is
also the possibility given to emit additional key-value pairs.
Modifier and Type | Method and Description |
---|---|
void |
finalized(Context<KeyOut,ValueOut> context)
This method is called after the
Mapper.map(Object, Object, Context) method is executed for every value and
can be used to finalize the internal state of the mapper or to emit a special value. |
void |
initialize(Context<KeyOut,ValueOut> context)
This method is called before the
Mapper.map(Object, Object, Context) method is executed for every value and
can be used to initialize the internal state of the mapper or to emit a special value. |
void initialize(Context<KeyOut,ValueOut> context)
Mapper.map(Object, Object, Context)
method is executed for every value and
can be used to initialize the internal state of the mapper or to emit a special value.context
- Context to be used for emitting valuesvoid finalized(Context<KeyOut,ValueOut> context)
Mapper.map(Object, Object, Context)
method is executed for every value and
can be used to finalize the internal state of the mapper or to emit a special value.context
- Context to be used for emitting valuesCopyright © 2014 Hazelcast, Inc.. All Rights Reserved.