public class ConvertingPropertyAccessor extends Object implements PersistentPropertyAccessor
PersistentPropertyAccessor that potentially converts the value handed to
setProperty(PersistentProperty, Object) to the type of the PersistentProperty using a
ConversionService. Exposes getProperty(PersistentProperty, Class) to allow obtaining the value of a
property in a type the ConversionService can convert the raw type to.| Constructor and Description |
|---|
ConvertingPropertyAccessor(PersistentPropertyAccessor accessor,
org.springframework.core.convert.ConversionService conversionService)
Creates a new
ConvertingPropertyAccessor for the given delegate PersistentPropertyAccessor and
ConversionService. |
| Modifier and Type | Method and Description |
|---|---|
Object |
getBean()
Returns the underlying bean.
|
Object |
getProperty(PersistentProperty<?> property)
Returns the value of the given
PersistentProperty of the underlying bean instance. |
<T> T |
getProperty(PersistentProperty<?> property,
Class<T> targetType)
Returns the value of the given
PersistentProperty converted to the given type. |
void |
setProperty(PersistentProperty<?> property,
Object value)
Sets the given
PersistentProperty to the given value. |
public ConvertingPropertyAccessor(PersistentPropertyAccessor accessor, org.springframework.core.convert.ConversionService conversionService)
ConvertingPropertyAccessor for the given delegate PersistentPropertyAccessor and
ConversionService.accessor - must not be null.conversionService - must not be null.public void setProperty(PersistentProperty<?> property, @Nullable Object value)
PersistentPropertyAccessorPersistentProperty to the given value. Will do type conversion if a
ConversionService is configured.setProperty in interface PersistentPropertyAccessorproperty - must not be null.value - can be null.@Nullable public Object getProperty(PersistentProperty<?> property)
PersistentPropertyAccessorPersistentProperty of the underlying bean instance.getProperty in interface PersistentPropertyAccessorproperty - must not be null.@Nullable public <T> T getProperty(PersistentProperty<?> property, Class<T> targetType)
PersistentProperty converted to the given type.property - must not be null.targetType - must not be null.public Object getBean()
PersistentPropertyAccessorgetBean in interface PersistentPropertyAccessorCopyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.