T - the type of the fieldE - the type of field update eventR - the type of reflection form builder to use for the component
productionC - the type of component to producepublic class MappingFieldHandler<T,E extends FieldUpdateEvent<T>,R extends ReflectionFormBuilder,C extends Component> extends ResettableFieldHandler<T,E,R,C>
TypeHandler mappings are generated by ClassMappingFactorys.| Constructor and Description |
|---|
MappingFieldHandler(Map<Type,FieldHandler<?,?,?,?>> classMapping,
Map<Class<?>,FieldHandler<?,?,?,?>> primitiveMapping,
de.richtercloud.message.handler.IssueHandler issueHandler)
Creates a
ClassMappingFieldHandler. |
| Modifier and Type | Method and Description |
|---|---|
Map<Type,FieldHandler<?,?,?,?>> |
getClassMapping() |
protected org.apache.commons.lang3.tuple.Pair<JComponent,ComponentHandler<?>> |
handle0(Field field,
Object instance,
FieldUpdateListener<E> updateListener,
R reflectionFormBuilder)
Must never return
null, otherwise #handle(java.lang.reflect.Field, java.lang.Object, richtercloud.reflection.form.builder.fieldhandler.FieldUpdateListener, richtercloud.reflection.form.builder.ReflectionFormBuilder) throws IllegalArgumentException. |
protected int |
retrieveAnyCountRecursively(ParameterizedType type) |
protected Type |
retrieveClassMappingBestMatch(ParameterizedType fieldParameterizedType)
Figures out candidates which the longest common prefix in the
fieldParameterizedType chain of (nested) generic types ignoring
specifications of AnyType. |
FieldHandler |
retrieveFieldHandler(Type fieldType,
Map<Type,FieldHandler<?,?,?,?>> classMapping) |
protected static <K,V> void |
validateMapping(List<org.apache.commons.lang3.tuple.Pair<K,V>> mapping,
String argumentName) |
handle, reset, retrieveDefaultComponentpublic MappingFieldHandler(Map<Type,FieldHandler<?,?,?,?>> classMapping, Map<Class<?>,FieldHandler<?,?,?,?>> primitiveMapping, de.richtercloud.message.handler.IssueHandler issueHandler)
ClassMappingFieldHandler. It's recommended to generate
classMapping with #generateClassMapping(java.lang.String, richtercloud.reflection.form.builder.components.AmountMoneyUsageStatisticsStorage, richtercloud.reflection.form.builder.components.AmountMoneyAdditionalCurrencyStorage, boolean) , #generateClassMappingDefault(java.lang.String) or
#generateClassMappingAmountMoneyFieldHandler(richtercloud.reflection.form.builder.components.AmountMoneyUsageStatisticsStorage, richtercloud.reflection.form.builder.components.AmountMoneyAdditionalCurrencyStorage, boolean) .classMapping - the class mappingprimitiveMapping - the primitive mappingissueHandler - the issue handler to useprotected static <K,V> void validateMapping(List<org.apache.commons.lang3.tuple.Pair<K,V>> mapping, String argumentName)
public Map<Type,FieldHandler<?,?,?,?>> getClassMapping()
protected org.apache.commons.lang3.tuple.Pair<JComponent,ComponentHandler<?>> handle0(Field field, Object instance, FieldUpdateListener<E> updateListener, R reflectionFormBuilder) throws FieldHandlingException, ResetException
null, otherwise #handle(java.lang.reflect.Field, java.lang.Object, richtercloud.reflection.form.builder.fieldhandler.FieldUpdateListener, richtercloud.reflection.form.builder.ReflectionFormBuilder) throws IllegalArgumentException.handle0 in class ResettableFieldHandler<T,E extends FieldUpdateEvent<T>,R extends ReflectionFormBuilder,C extends Component>field - the field to handleinstance - the instance to create forupdateListener - the update listener to usereflectionFormBuilder - the reflection form builder to useFieldHandlingException - wraps all exceptions occuring during read
or write access to fieldsResetException - if an exception during resetting the field occurspublic FieldHandler retrieveFieldHandler(Type fieldType, Map<Type,FieldHandler<?,?,?,?>> classMapping)
fieldType - always call with return value of
Field.getGenericType() in order to be the correct matchclassMapping - the class mapping to use (it might be necessary to
use different class mappings for entities and embeddables if
components check if field types are entities)protected Type retrieveClassMappingBestMatch(ParameterizedType fieldParameterizedType)
fieldParameterizedType chain of (nested) generic types ignoring
specifications of AnyType. Then determines the candidates with
the smallest number of AnyType specifications in the chain. If
there're multiple with the same number of AnyType chooses the
first it finds which might lead to random choices.fieldParameterizedType - the chain of generic types (remember to
retrieve this information with Field.getGenericType()
instead of Field.getType() from fields)null if no
candidate existsprotected int retrieveAnyCountRecursively(ParameterizedType type)
Copyright © 2018. All rights reserved.