S
- the source typeT
- the target typepublic static class Binder.BinderModel<S,T> extends Object implements Serializable
Binder
.
TODO tchemit 20100225 should have special cases for collections treatment.Modifier and Type | Field and Description |
---|---|
protected Map<String,Binder<?,?>> |
binders
mapping of extra binders to use to copy properties
|
protected Map<String,Binder.CollectionStrategy> |
collectionStrategies
mapping of collection properties strategies
|
protected Map<Class<?>,com.google.common.base.Function<?,?>> |
functions
Dictonnary of function to apply by source class type.
|
protected InstanceFactory<T> |
instanceFactory
factory of target Instance
|
protected Map<String,String> |
propertiesMapping
properties mapping (key are source properties, value are destination
properties)
|
protected Map<String,PropertyDescriptor> |
sourceDescriptors
source type descriptors (key are property names)
|
protected Class<S> |
sourceType
source type
|
protected Map<String,PropertyDescriptor> |
targetDescriptors
destination descriptors (key are property names)
|
protected Class<T> |
targetType
destination type
|
Constructor and Description |
---|
BinderModel(Class<S> sourceType,
Class<T> targetType) |
Modifier and Type | Method and Description |
---|---|
void |
addBinder(String propertyName,
Binder<?,?> binder) |
protected void |
addBinding(PropertyDescriptor sourceDescriptor,
PropertyDescriptor targetDescriptor) |
void |
addCollectionStrategy(String propertyName,
Binder.CollectionStrategy strategy) |
boolean |
containsBinderProperty(String propertyName) |
boolean |
containsCollectionProperty(String propertyName) |
boolean |
containsSourceProperty(String sourceProperty) |
boolean |
containsTargetProperty(String targetProperty) |
Binder<?,?> |
getBinder(String sourceProperty) |
Binder.CollectionStrategy |
getCollectionStrategy(String property) |
Class<?> |
getCollectionType(String sourceProperty) |
com.google.common.base.Function |
getFunction(Class<?> aClass) |
InstanceFactory<T> |
getInstanceFactory() |
protected Map<String,String> |
getPropertiesMapping() |
PropertyDescriptor |
getSourceDescriptor(String sourceProperty)
Gets the bean descriptor of the source type for the given
destination property.
|
String[] |
getSourceDescriptors()
Gets all registred property names of the binder's source type.
|
Method |
getSourceReadMethod(String srcProperty) |
Class<S> |
getSourceType()
Gets the type of the binder's source.
|
Method |
getSourceWriteMethod(String sourceProperty) |
PropertyDescriptor |
getTargetDescriptor(String targetProperty)
Gets the bean descriptor of the destination type for the given
destination property.
|
String[] |
getTargetDescriptors()
Gets all registred property names of the binder's destination type.
|
String |
getTargetProperty(String sourceProperty)
Gets the destination property name given the
|
Method |
getTargetReadMethod(String targetProperty) |
Class<T> |
getTargetType()
Gets the type of the binder's destination
|
Method |
getTargetWriteMethod(String targetProperty) |
boolean |
isUseFunctions() |
protected void |
removeBinding(String source) |
void |
setInstanceFactory(InstanceFactory<T> instanceFactory) |
protected final Map<String,PropertyDescriptor> sourceDescriptors
protected final Map<String,PropertyDescriptor> targetDescriptors
protected final Map<String,String> propertiesMapping
protected Map<String,Binder.CollectionStrategy> collectionStrategies
protected Map<String,Binder<?,?>> binders
protected InstanceFactory<T> instanceFactory
public Class<S> getSourceType()
public Class<T> getTargetType()
public String[] getSourceDescriptors()
public Binder.CollectionStrategy getCollectionStrategy(String property)
public String[] getTargetDescriptors()
public String getTargetProperty(String sourceProperty)
sourceProperty
- the name of the source property to bindnull
if propertySrc
is unknown in the modelpublic PropertyDescriptor getSourceDescriptor(String sourceProperty)
sourceProperty
- name of the source type property namenull
if not found.public Method getSourceReadMethod(String srcProperty)
srcProperty
- the name of a property of the source object.public Method getSourceWriteMethod(String sourceProperty)
sourceProperty
- the name of a property of the source object.public PropertyDescriptor getTargetDescriptor(String targetProperty)
targetProperty
- name of the destination type property namenull
if not found.public Method getTargetReadMethod(String targetProperty)
targetProperty
- the name of a property of the destination object.public Method getTargetWriteMethod(String targetProperty)
targetProperty
- the name of a property of the destination object.public void addCollectionStrategy(String propertyName, Binder.CollectionStrategy strategy)
public boolean containsSourceProperty(String sourceProperty)
public boolean containsTargetProperty(String targetProperty)
public boolean containsCollectionProperty(String propertyName)
public boolean containsBinderProperty(String propertyName)
protected void addBinding(PropertyDescriptor sourceDescriptor, PropertyDescriptor targetDescriptor)
protected void removeBinding(String source)
public void setInstanceFactory(InstanceFactory<T> instanceFactory)
public InstanceFactory<T> getInstanceFactory()
public com.google.common.base.Function getFunction(Class<?> aClass)
public boolean isUseFunctions()
Copyright © 2004–2020 CodeLutin. All rights reserved.