IN
- is the generic input-type
.VALUE
- is the generic value-type
public abstract class AbstractPojoPathFunction<IN,VALUE> extends AbstractLoggableComponent implements PojoPathFunction<IN,VALUE>
PojoPathFunction
interface.FUNCTION_NAME_PREFIX
Constructor and Description |
---|
AbstractPojoPathFunction()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
VALUE |
create(IN actual,
String functionName,
PojoPathContext context)
This method creates an appropriate new value.
|
VALUE |
get(IN actual,
String functionName,
PojoPathContext context)
This method gets the value of this function.
|
protected String |
getFunctionDescription(String functionName)
This method gets a description of this function.
|
boolean |
isDeterministic()
This method determines if this
PojoPathFunction is deterministic. |
VALUE |
set(IN actual,
String functionName,
VALUE value,
PojoPathContext context)
|
String |
toString() |
createLogger, doInitialize, getLogger
doInitialized, getInitializationState, initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getInputClass, getValueClass
public boolean isDeterministic()
PojoPathFunction
is deterministic. In this case it has to guarantee that
repetitive calls of get
with the same (unmodified) actual
Pojo
will produce the same result. PojoPathFunction
should be deterministic. However in some cases the calculation of a
PojoPathFunction
may depend on the current time or a random value and will therefore be indeterministic.
PojoPathFunction
is indeterministic, the caching
will disabled for
its result and further traversals. true
. Override for indeterministic implementations.isDeterministic
in interface PojoPathFunction<IN,VALUE>
true
if this function is deterministic, false
otherwise.protected String getFunctionDescription(String functionName)
functionName
- is the name under which this function was invoked.public VALUE create(IN actual, String functionName, PojoPathContext context)
PojoPathFunction
PojoPathNavigator
.
get
if the mode is
PojoPathMode.CREATE_IF_NULL
after get
returned null
.
pojo-factory
. Further in most cases the created value instance will be attached to the given actual
Pojo
.create
in interface PojoPathFunction<IN,VALUE>
actual
- is the actual Pojo
where this function is invoked on. Typically the
returned value should be retrieved via this object.functionName
- is the name under which this PojoPathFunction
was invoked via the
PojoPathNavigator
excluding the PojoPathFunction.FUNCTION_NAME_PREFIX
.context
- is the PojoPathContext
providing additional context information. Objects traversed between
actual
and the returned value should be recognized
via the recognizer
.null
if creation is NOT possible. However returning null
here
will cause the PojoPathNavigator
to fail with an exception.public VALUE get(IN actual, String functionName, PojoPathContext context)
PojoPathFunction
PojoPathNavigator
.
get
independent of the
PojoPathMode
. A regular implementation should only return what is already there. However in specific cases
this may NOT (initially) be available from the given Pojo
actual
and
therefore be retrieved from somewhere else (e.g. a database using a primary key given via a
property
of the given context
). Further it can be legal to modify
the actual
Pojo
e.g. by attaching the externally retrieved result.get
in interface PojoPathFunction<IN,VALUE>
actual
- is the actual Pojo
where this function is invoked on. Typically the
returned value should be retrieved via this object.functionName
- is the name under which this PojoPathFunction
was invoked via the
PojoPathNavigator
excluding the PojoPathFunction.FUNCTION_NAME_PREFIX
.context
- is the PojoPathContext
providing additional context information. Objects traversed between
actual
and the returned value should be recognized
via the recognizer
.null
if NOT available.public VALUE set(IN actual, String functionName, VALUE value, PojoPathContext context)
PojoPathFunction
value
for the given actual
Pojo
. get
should return the same value
for identical arguments.set
in interface PojoPathFunction<IN,VALUE>
actual
- is the actual Pojo
where this function is invoked on. Typically the
given value
should be set in this object.functionName
- is the name under which this PojoPathFunction
was invoked via the
PojoPathNavigator
excluding the PojoPathFunction.FUNCTION_NAME_PREFIX
.value
- is the value to set.context
- is the PojoPathContext
providing additional context information. Objects traversed between
actual
and the returned value should be recognized
via the recognizer
.null
.Copyright © 2001–2016 mmm-Team. All rights reserved.