VALUE
- is the generic type of the value to adapt.public class UiDataBindingAdapterImpl<VALUE> extends Object implements UiDataBindingAdapter<VALUE>
UiDataBindingAdapter
based on PojoDescriptor
.Modifier and Type | Field and Description |
---|---|
private DatatypeDetector |
datatypeDetector
The
DatatypeDetector instance. |
private PojoDescriptor<VALUE> |
descriptor
The
PojoDescriptor used to implement the functionality. |
private PojoDescriptorBuilder |
descriptorBuilder
The
PojoDescriptorBuilder instance. |
private MathUtilLimited |
mathUtil |
private javax.validation.Validator |
validator
The
Validator instance. |
Constructor and Description |
---|
UiDataBindingAdapterImpl(Class<VALUE> type,
PojoDescriptorBuilderFactory descriptorBuilderFactory,
DatatypeDetector datatypeDetector,
javax.validation.Validator validator,
MathUtilLimited mathUtil)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
VALUE |
copy(VALUE value)
This method creates a copy (e.g.
|
private <V> V |
copy(V value,
PojoDescriptor<V> pojoDescriptor) |
VALUE |
createNewValue() |
protected MathUtilLimited |
getMathUtil() |
<T> Class<T> |
getPropertyType(TypedProperty<T> property)
This method gets the
property type of the given
TypedProperty . |
<T> ValueValidator<T> |
getPropertyValidator(TypedProperty<T> property,
Class<T> propertyType)
This method gets or creates the
ValueValidator for the specified property. |
Object |
getPropertyValue(VALUE pojo,
String property)
This method gets the value of the specified property.
|
<T> T |
getPropertyValue(VALUE pojo,
TypedProperty<T> property)
This method gets the value of the specified property.
|
<T> Range<?> |
getRangeConstraints(TypedProperty<T> property,
Class<T> propertyType)
|
void |
setPropertyValue(VALUE pojo,
String property,
Object propertyValue)
This method sets the value of the specified property.
|
<T> void |
setPropertyValue(VALUE pojo,
TypedProperty<T> property,
T propertyValue)
This method sets the value of the specified property.
|
private final PojoDescriptorBuilder descriptorBuilder
PojoDescriptorBuilder
instance.private final PojoDescriptor<VALUE> descriptor
PojoDescriptor
used to implement the functionality.private final DatatypeDetector datatypeDetector
DatatypeDetector
instance.private final javax.validation.Validator validator
Validator
instance.private final MathUtilLimited mathUtil
getMathUtil()
public UiDataBindingAdapterImpl(Class<VALUE> type, PojoDescriptorBuilderFactory descriptorBuilderFactory, DatatypeDetector datatypeDetector, javax.validation.Validator validator, MathUtilLimited mathUtil)
type
- is the Class
reflecting the value to adapt.descriptorBuilderFactory
- is the PojoDescriptorBuilderFactory
instance.datatypeDetector
- is the DatatypeDetector
instance.validator
- is the Validator
instance.mathUtil
- is the MathUtilLimited
instance.protected MathUtilLimited getMathUtil()
public VALUE copy(VALUE value)
clone
) of the given
value
. If the given value
is immutable (like String
, Long
,
etc.) it is legal to return the same given instance.copy
in interface UiDataBindingAdapter<VALUE>
value
- is the value to copy.public VALUE createNewValue()
createNewValue
in interface UiDataBindingAdapter<VALUE>
private <V> V copy(V value, PojoDescriptor<V> pojoDescriptor)
V
- the generic type of the value (for recursive invocation).value
- is the value to copy.pojoDescriptor
- is the PojoDescriptor
for value
.value
.copy(Object)
public <T> ValueValidator<T> getPropertyValidator(TypedProperty<T> property, Class<T> propertyType)
ValueValidator
for the specified property.getPropertyValidator
in interface UiDataBindingAdapter<VALUE>
T
- is the generic property type
.property
- is the TypedProperty
.propertyType
- is the Class
reflecting the property
type
.ValueValidator
for the given property.public <T> Range<?> getRangeConstraints(TypedProperty<T> property, Class<T> propertyType)
Range
of the value for the specified property
in
the Pojo
associated with this adapter. It will consider JSR 303
annotations such as Min
, Max
,
DecimalMin
, and DecimalMax
.getRangeConstraints
in interface UiDataBindingAdapter<VALUE>
T
- is the generic type of the property.property
- is the TypedProperty
.propertyType
- is the Class
reflecting the property
type
.Range
or null
if unbound.public <T> Class<T> getPropertyType(TypedProperty<T> property)
property type
of the given
TypedProperty
. This method might work even if TypedProperty.getPropertyType()
returns
null
.getPropertyType
in interface UiDataBindingAdapter<VALUE>
T
- is the generic property type
.property
- is the TypedProperty
.property type
of the given property
.public <T> T getPropertyValue(VALUE pojo, TypedProperty<T> property)
getPropertyValue
in interface UiDataBindingAdapter<VALUE>
T
- is the generic property type
.pojo
- is the Pojo
owning the property.property
- is the TypedProperty
.UiDataBindingAdapter.getPropertyValue(Object, String)
public Object getPropertyValue(VALUE pojo, String property)
getPropertyValue(pojo, "foo")
is supposed to return pojo.getFoo()
.getPropertyValue
in interface UiDataBindingAdapter<VALUE>
pojo
- is the Pojo
owning the property.property
- is the name of the requested property.public <T> void setPropertyValue(VALUE pojo, TypedProperty<T> property, T propertyValue)
setPropertyValue
in interface UiDataBindingAdapter<VALUE>
T
- is the generic property type
.pojo
- is the Pojo
owning the property.property
- is the TypedProperty
.propertyValue
- is the property value to set.UiDataBindingAdapter.setPropertyValue(Object, String, Object)
public void setPropertyValue(VALUE pojo, String property, Object propertyValue)
setPropertyValue(pojo, "foo", value)
is supposed to do pojo.setFoo(value)
.setPropertyValue
in interface UiDataBindingAdapter<VALUE>
pojo
- is the Pojo
owning the property.property
- is the name of the property to set.propertyValue
- is the property value to set.Copyright © 2001–2016 mmm-Team. All rights reserved.