public abstract class ParamsRequestToEntitiesTransformer<T> extends Object implements FunctionTransformer
Mapping of 'Param type class' representing the entity to the actual entities instance. If retainOriginalInputParams is true then it will also retain all the original input params in the output MapINPUT_KEY for easy access; since one cannot always be sure of the input type.
| Modifier and Type | Class and Description |
|---|---|
static class |
ParamsRequestToEntitiesTransformer.PropertyBinding |
| Modifier and Type | Field and Description |
|---|---|
static String |
INPUT_KEY
Access the raw input to this Transformer
|
| Constructor and Description |
|---|
ParamsRequestToEntitiesTransformer() |
| Modifier and Type | Method and Description |
|---|---|
List<Class> |
getEntities()
List of classes representing entities to bind the request to.
|
Map<String,EntityFieldSetter> |
getEntityFieldSetters()
Map form field to an
EntityFieldSetter where conventionally BeanUtils cannot work over the entity field to set it |
protected abstract List<String> |
getParamNames(T input) |
Map<String,List<ParamsRequestToEntitiesTransformer.PropertyBinding>> |
getPropertyBindings()
Map of Request field name to the
ParamsRequestToEntitiesTransformer.PropertyBinding binding(s). |
Map<String,org.apache.commons.collections.Transformer> |
getTransformPropertyBindings()
Map Form field name to a Transformer, whose transformed value will be supplied to the Field name mentioned in bindings
|
protected abstract Object |
getValue(T input,
String paramName) |
boolean |
isIgnoreUnMappedFields()
If true; the binding process will ignore any fields that are specified in the input form post and not mapped on server
|
boolean |
isRetainOriginalInputParams()
If true will also add the original raw input params in the transformed output
Map |
protected List<ParamsRequestToEntitiesTransformer.PropertyBinding> |
resolveParamNameToBinding(String paramName)
This method will return a
ParamsRequestToEntitiesTransformer.PropertyBinding name for a given parameter. |
void |
setEntities(List<Class> entities)
List of classes representing entities to bind the request to.
|
void |
setEntityFieldSetters(Map<String,EntityFieldSetter> entityFieldSetters)
Map form field to an
EntityFieldSetter where conventionally BeanUtils cannot work over the entity field to set it |
void |
setIgnoreUnMappedFields(boolean ignoreUnMappedFields)
If true; the binding process will ignore any fields that are specified in the input form post and not mapped on server
|
void |
setPropertyBindings(Map<String,List<ParamsRequestToEntitiesTransformer.PropertyBinding>> propertyBindings)
Map of Request field name to the
ParamsRequestToEntitiesTransformer.PropertyBinding binding(s). |
void |
setRetainOriginalInputParams(boolean retainOriginalInputParams)
If true will also add the original raw input params in the transformed output
Map |
void |
setTransformPropertyBindings(Map<String,org.apache.commons.collections.Transformer> transformPropertyBindings)
Map Form field name to a Transformer, whose transformed value will be supplied to the Field name mentioned in bindings
|
protected void |
setupContextVariables(Map instanceMap,
T input) |
Object |
transform(Object input) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplypublic static final String INPUT_KEY
protected List<ParamsRequestToEntitiesTransformer.PropertyBinding> resolveParamNameToBinding(String paramName)
ParamsRequestToEntitiesTransformer.PropertyBinding name for a given parameter.
If the mapping involved nested entities then it will return the binding to the most nested field available.paramName - List of ParamsRequestToEntitiesTransformer.PropertyBindingNoSuchFieldExceptionpublic Object transform(Object input)
transform in interface org.apache.commons.collections.Transformerpublic List<Class> getEntities()
public void setEntities(List<Class> entities)
public Map<String,List<ParamsRequestToEntitiesTransformer.PropertyBinding>> getPropertyBindings()
ParamsRequestToEntitiesTransformer.PropertyBinding binding(s). Ther same field name may have multiple bindings hence the value is a ListTransformer
in transformPropertyBindings to fine the transformation from the request to the entity.
resolveParamNameToBinding(String)public void setPropertyBindings(Map<String,List<ParamsRequestToEntitiesTransformer.PropertyBinding>> propertyBindings)
ParamsRequestToEntitiesTransformer.PropertyBinding binding(s). Ther same field name may have multiple bindings hence the value is a ListTransformer
in transformPropertyBindings to fine the transformation from the request to the entity.
resolveParamNameToBinding(String)public Map<String,org.apache.commons.collections.Transformer> getTransformPropertyBindings()
public void setTransformPropertyBindings(Map<String,org.apache.commons.collections.Transformer> transformPropertyBindings)
public boolean isIgnoreUnMappedFields()
public void setIgnoreUnMappedFields(boolean ignoreUnMappedFields)
public Map<String,EntityFieldSetter> getEntityFieldSetters()
EntityFieldSetter where conventionally BeanUtils cannot work over the entity field to set itpublic void setEntityFieldSetters(Map<String,EntityFieldSetter> entityFieldSetters)
EntityFieldSetter where conventionally BeanUtils cannot work over the entity field to set itpublic boolean isRetainOriginalInputParams()
Mappublic void setRetainOriginalInputParams(boolean retainOriginalInputParams)
MapCopyright © 2018. All rights reserved.