IN
- Type of input to the adapted functionOUT
- Type of output of the adapted functionpublic class ContextFunctionAdaptor<IN,OUT> extends ContextAdaptor<Function<IN,OUT>,IN,OUT> implements Function<Context,Context>
Function
to be applied to a single element
of a Context
, and store its output in a (potentially) different slot
of the Context
.extract, inner, insert
Constructor and Description |
---|
ContextFunctionAdaptor(Function<IN,OUT> inner,
ContextExtractor<IN> extract,
ContextInsertor<OUT> insert) |
ContextFunctionAdaptor(Function<IN,OUT> inner,
String extract,
String insert)
Construct
ContextFunctionAdaptor that reads data from a given
key, applies a function and sets the result in a different key. |
ContextFunctionAdaptor(String both,
Function<IN,OUT> inner)
Construct
ContextFunctionAdaptor that reads data from a given
key, applies a function and sets the result with the same key. |
Modifier and Type | Method and Description |
---|---|
Context |
apply(Context in)
Apply the function to the input argument and return the result.
|
static <IN,OUT> Function<Context,Context> |
create(String extract,
String insert,
Function<IN,OUT> inner)
Create a new
ContextFunctionAdaptor that reads data from a given
key, applies a function and sets the result in a different key. |
public ContextFunctionAdaptor(Function<IN,OUT> inner, ContextExtractor<IN> extract, ContextInsertor<OUT> insert)
inner
- extract
- insert
- public ContextFunctionAdaptor(Function<IN,OUT> inner, String extract, String insert)
ContextFunctionAdaptor
that reads data from a given
key, applies a function and sets the result in a different key.extract
- the key to pull data frominsert
- the key to write the result toinner
- the function to applypublic ContextFunctionAdaptor(String both, Function<IN,OUT> inner)
ContextFunctionAdaptor
that reads data from a given
key, applies a function and sets the result with the same key.both
- the extract and insert keyinner
- the function to applypublic Context apply(Context in)
Function
public static <IN,OUT> Function<Context,Context> create(String extract, String insert, Function<IN,OUT> inner)
ContextFunctionAdaptor
that reads data from a given
key, applies a function and sets the result in a different key.extract
- the key to pull data frominsert
- the key to write the result toinner
- the function to applyContextFunctionAdaptor