Class Binder.BinderModel<S,T>
java.lang.Object
org.nuiton.util.beans.Binder.BinderModel<S,T>
- Type Parameters:
S- the source typeT- the target type
- All Implemented Interfaces:
Serializable
Model of a
Binder.
TODO tchemit 20100225 should have special cases for collections treatment.- Since:
- 1.1.5
- Author:
- Tony Chemit - chemit@codelutin.com
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionmapping of extra binders to use to copy propertiesprotected Map<String, Binder.CollectionStrategy> mapping of collection properties strategiesDictonnary of function to apply by source class type.protected InstanceFactory<T> factory of target Instanceproperties mapping (key are source properties, value are destination properties)protected final Map<String, PropertyDescriptor> source type descriptors (key are property names)source typeprotected final Map<String, PropertyDescriptor> destination descriptors (key are property names)destination type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddBinding(PropertyDescriptor sourceDescriptor, PropertyDescriptor targetDescriptor) voidaddCollectionStrategy(String propertyName, Binder.CollectionStrategy strategy) booleancontainsBinderProperty(String propertyName) booleancontainsCollectionProperty(String propertyName) booleancontainsSourceProperty(String sourceProperty) booleancontainsTargetProperty(String targetProperty) Binder<?, ?> getCollectionStrategy(String property) Class<?> getCollectionType(String sourceProperty) com.google.common.base.FunctiongetFunction(Class<?> aClass) getSourceDescriptor(String sourceProperty) Gets the bean descriptor of the source type for the given destination property.String[]Gets all registred property names of the binder's source type.getSourceReadMethod(String srcProperty) Gets the type of the binder's source.getSourceWriteMethod(String sourceProperty) getTargetDescriptor(String targetProperty) Gets the bean descriptor of the destination type for the given destination property.String[]Gets all registred property names of the binder's destination type.getTargetProperty(String sourceProperty) Gets the destination property name given thegetTargetReadMethod(String targetProperty) Gets the type of the binder's destinationgetTargetWriteMethod(String targetProperty) booleanprotected voidremoveBinding(String source) voidsetInstanceFactory(InstanceFactory<T> instanceFactory)
-
Field Details
-
sourceType
-
targetType
-
sourceDescriptors
source type descriptors (key are property names) -
targetDescriptors
destination descriptors (key are property names) -
propertiesMapping
-
collectionStrategies
mapping of collection properties strategies -
binders
-
instanceFactory
factory of target Instance -
functions
-
-
Constructor Details
-
BinderModel
-
-
Method Details
-
getSourceType
-
getTargetType
-
getSourceDescriptors
Gets all registred property names of the binder's source type.- Returns:
- the array of all source object properties names to bind
-
getCollectionStrategy
-
getTargetDescriptors
Gets all registred property names of the binder's destination type.- Returns:
- the array of all source object properties names to bind
-
getTargetProperty
-
getSourceDescriptor
Gets the bean descriptor of the source type for the given destination property.- Parameters:
sourceProperty- name of the source type property name- Returns:
- the descriptor or
nullif not found.
-
getSourceReadMethod
-
getSourceWriteMethod
-
getTargetDescriptor
Gets the bean descriptor of the destination type for the given destination property.- Parameters:
targetProperty- name of the destination type property name- Returns:
- the descriptor or
nullif not found.
-
getTargetReadMethod
-
getTargetWriteMethod
-
getCollectionType
-
addCollectionStrategy
-
addBinder
-
containsSourceProperty
-
containsTargetProperty
-
containsCollectionProperty
-
containsBinderProperty
-
addBinding
-
removeBinding
-
getPropertiesMapping
-
getBinder
-
setInstanceFactory
-
getInstanceFactory
-
getFunction
-
isUseFunctions
public boolean isUseFunctions()
-