public class EnsureAccessorExistsTransformer extends UsesIntermediateObjectImpl<Map<String,Object>> implements ModeAware, org.apache.commons.collections.Transformer, Serializable
Transformer
does not apply any Transformation on the input itself (unless there is no intermediate object), however for the intermediate object passed it#updateChild(Object, Object, String)
and write your own transformations on specific entities instance creation & setting.
ModeAware
to because when dealing with accessors it is often required to treat the related entity in context to the mode.
TODO: Add unit test caseCreateEntityTransformer
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Map<String,Class> |
accessClasses
For each accessor in the
accessor provide a Constructor Class |
protected Map<String,Object> |
accessValues
For each accessor in the
accessor provide a default Value.If it exists it will override accessClasses for same type. |
protected Mode |
mode |
protected List<Mode> |
modesSupported
What all modes does this Reader support
Default All defined in Mode |
intermediateResults, resultNamesUsed, resultsThatAreOptional
Constructor and Description |
---|
EnsureAccessorExistsTransformer() |
Modifier and Type | Method and Description |
---|---|
Map<String,Class> |
getAccessClasses()
For each accessor in the
accessor provide a Constructor Class |
String |
getAccessor()
A dot separated list of entities.
|
Map<String,Object> |
getAccessValues()
For each accessor in the
accessor provide a default Value.If it exists it will override accessClasses for same type. |
Mode |
getMode()
The processing logic of the Reader may differ based n the fact it is intended to Update or Insert or Delete
|
List<Mode> |
getModesSupported()
Get the
Mode s supported by the instance |
void |
setAccessClasses(Map<String,Class> accessClasses)
For each accessor in the
accessor provide a Constructor Class |
void |
setAccessor(String accessor)
A dot separated list of entities.
|
void |
setAccessValues(Map<String,Object> accessValues)
For each accessor in the
accessor provide a default Value.If it exists it will override accessClasses for same type. |
void |
setMode(Mode mode) |
void |
setModesSupported(List<Mode> modesSupported) |
protected boolean |
skip(Object input)
Custom logic to Skip Creation of Accessors based on input available.
|
Object |
transform(Object input) |
Object |
transform(String accessor,
Object input) |
protected Object |
updateChild(List parents,
Object child,
String property)
Override how an instance is created in the Entity access chain
|
determineInput, getInputFromContext, getInterMediateResults, getResultNamesThatAreOptional, getResultNamesUsed, setIntermediateResults, setResultNamesThatAreOptional, setResultNamesUsed
protected Mode mode
protected List<Mode> modesSupported
Mode
protected Map<String,Class> accessClasses
accessor
provide a Constructor Classpublic Object transform(Object input)
transform
in interface org.apache.commons.collections.Transformer
protected Object updateChild(List parents, Object child, String property) throws Exception
parents
- as List (in order of accessors; with the base entity @ 0th position and immediate parent @ last position)child
- property
- Exception
public String getAccessor()
public void setAccessor(String accessor)
public Map<String,Class> getAccessClasses()
accessor
provide a Constructor Classpublic void setAccessClasses(Map<String,Class> accessClasses)
accessor
provide a Constructor Classpublic Map<String,Object> getAccessValues()
accessor
provide a default Value.public void setAccessValues(Map<String,Object> accessValues)
accessor
provide a default Value.protected boolean skip(Object input)
ContinueProcessingException
input
- public Mode getMode()
ModeAware
getMode
in interface ModeAware
Mode
Mode.INSERT
public void setMode(Mode mode)
setMode
in interface ModeAware
Mode.INSERT
public List<Mode> getModesSupported()
ModeAware
Mode
s supported by the instancegetModesSupported
in interface ModeAware
Copyright © 2018. All rights reserved.