public class BeanWrapper<E extends PersistentEntity<T,?>,T> extends Object
Modifier and Type | Method and Description |
---|---|
static <E extends PersistentEntity<T,?>,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,
boolean fieldAccessOnly)
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. |
void |
setProperty(PersistentProperty<?> property,
Object value,
boolean fieldAccessOnly)
Sets the given
PersistentProperty to the given value. |
public static <E extends PersistentEntity<T,?>,T> BeanWrapper<E,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.E
- T
- bean
- must not be nullconversionService
- public void setProperty(PersistentProperty<?> property, Object value)
PersistentProperty
to the given value. Will do type conversion if a
ConversionService
is configured. Will use the accessor method of the given PersistentProperty
if it
has one or field access otherwise.property
- must not be null.value
- public void setProperty(PersistentProperty<?> property, Object value, boolean fieldAccessOnly)
PersistentProperty
to the given value. Will do type conversion if a
ConversionService
is configured.property
- must not be null.value
- fieldAccessOnly
- whether to only try accessing the field (true) or try using the getter first.IllegalAccessException
InvocationTargetException
public Object getProperty(PersistentProperty<?> property)
PersistentProperty
of the underlying bean instance.S
- property
- public <S> S getProperty(PersistentProperty<?> property, Class<? extends S> type, boolean fieldAccessOnly)
PersistentProperty
potentially converted to the given type.S
- property
- must not be null.type
- fieldAccessOnly
- public T getBean()
Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.