public class BeanWrapper<T> extends Object
Modifier and Type | Method and Description |
---|---|
static <T> BeanWrapper<T> |
create(T bean,
ConversionService conversionService)
Creates a new
BeanWrapper for the given bean instance and ConversionService . |
T |
getBean()
Returns the underlying bean instance.
|
Object |
getProperty(PersistentProperty<?> property)
Returns the value of the given
PersistentProperty of the underlying bean instance. |
<S> S |
getProperty(PersistentProperty<?> property,
Class<? extends S> type)
Returns the value of the given
PersistentProperty potentially converted to the given type. |
void |
setProperty(PersistentProperty<?> property,
Object value)
Sets the given
PersistentProperty to the given value. |
public static <T> BeanWrapper<T> create(T bean, ConversionService conversionService)
BeanWrapper
for the given bean instance and ConversionService
. If
ConversionService
is null no property type conversion will take place.T
- bean
- must not be null.conversionService
- can be null.public void setProperty(PersistentProperty<?> property, Object value)
PersistentProperty
to the given value. Will do type conversion if a
ConversionService
is configured.property
- must not be null.value
- can be null.MappingException
- in case an exception occurred when setting the property value.public Object getProperty(PersistentProperty<?> property)
PersistentProperty
of the underlying bean instance.S
- property
- must not be null.public <S> S getProperty(PersistentProperty<?> property, Class<? extends S> type)
PersistentProperty
potentially converted to the given type.S
- property
- must not be null.type
- can be null.MappingException
- in case an exception occured when accessing the property.public T getBean()
Copyright © 2011-2014–2015 Pivotal Software, Inc.. All rights reserved.