public class ConvertingPropertyAccessor<T> extends Object implements PersistentPropertyAccessor<T>
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<T> accessor,
ConversionService conversionService)
Creates a new
ConvertingPropertyAccessor for the given delegate PersistentPropertyAccessor and
ConversionService. |
| Modifier and Type | Method and Description |
|---|---|
T |
getBean()
Returns the underlying bean.
|
Object |
getProperty(PersistentProperty<?> property)
Returns the value of the given
PersistentProperty of the underlying bean instance. |
<S> S |
getProperty(PersistentProperty<?> property,
Class<S> 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. |
void |
setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
Object value)
Sets the given value for the
PersistentProperty pointed to by the given PersistentPropertyPath. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProperty, getPropertypublic ConvertingPropertyAccessor(PersistentPropertyAccessor<T> 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, @Nullable Object value)
PersistentPropertyAccessorPersistentProperty to the given value. Will do type conversion if a
ConversionService is configured.setProperty in interface PersistentPropertyAccessor<T>property - must not be null.value - can be null.public void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, @Nullable Object value)
PersistentPropertyAccessorPersistentProperty pointed to by the given PersistentPropertyPath. The
lookup of intermediate values must not yield null.setProperty in interface PersistentPropertyAccessor<T>path - must not be null or empty.value - can be null.@Nullable public Object getProperty(PersistentProperty<?> property)
PersistentPropertyAccessorPersistentProperty of the underlying bean instance.getProperty in interface PersistentPropertyAccessor<T>property - must not be null.@Nullable public <S> S getProperty(PersistentProperty<?> property, Class<S> targetType)
PersistentProperty converted to the given type.property - must not be null.targetType - must not be null.public T getBean()
PersistentPropertyAccessorPersistentPropertyAccessor.setProperty(PersistentProperty, Object) calls.getBean in interface PersistentPropertyAccessor<T>Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.