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,
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.
|
Optional<Object> |
getProperty(PersistentProperty<?> property)
Returns the value of the given
PersistentProperty of the underlying bean instance. |
<T> Optional<T> |
getProperty(PersistentProperty<?> property,
Class<T> targetType)
Returns the value of the given
PersistentProperty converted to the given type. |
void |
setProperty(PersistentProperty<?> property,
Optional<? extends Object> value)
Sets the given
PersistentProperty to the given value. |
public ConvertingPropertyAccessor(PersistentPropertyAccessor accessor, 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, Optional<? extends 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.public Optional<Object> getProperty(PersistentProperty<?> property)
PersistentPropertyAccessorPersistentProperty of the underlying bean instance.getProperty in interface PersistentPropertyAccessorproperty - must not be null.public <T> Optional<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-2016–2017 Pivotal Software, Inc.. All rights reserved.