Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Spring Data Commons
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.data.mapping.model
Class BeanWrapper<E extends PersistentEntity<T,?>,T>

    java.lang.Object
      org.springframework.data.mapping.model.BeanWrapper<E,T>

    public class BeanWrapper<E extends PersistentEntity<T,?>,T>

extends Object

Value object to allow creation of objects using the metamodel, setting and getting properties.

Author:
  Oliver Gierke

Method Summary
`static
`<E extends PersistentEntity<T,?>,T> BeanWrapper<E,T>`
` | `create(E entity, ParameterValueProvider provider, ConversionService conversionService)` Creates a new `BeanWrapper` using the given `PersistentEntity` and `ParameterValueProvider`.
`static
`<E extends PersistentEntity<T,?>,T> BeanWrapper<E,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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### create

    public static <E extends PersistentEntity<T,?>,T> BeanWrapper<E,T> create(T bean,
                                                                              ConversionService conversionService)

  Creates a new `BeanWrapper` for the given bean instance and `ConversionService`. If `ConversionService` is null no property type conversion will take place.

  Type Parameters:
    `E` -
    `T` -
  Parameters:
    `bean` - must not be null
    `conversionService` -
  Returns:

### create

    public static <E extends PersistentEntity<T,?>,T> BeanWrapper<E,T> create(E entity,
                                                                              ParameterValueProvider provider,
                                                                              ConversionService conversionService)

  Creates a new `BeanWrapper` using the given `PersistentEntity` and `ParameterValueProvider`. Will instantly create a bean instance using the `PreferredConstructor` of the `PersistentEntity`.

  Type Parameters:
    `E` -
    `T` -
  Parameters:
    `entity` -
    `provider` -
    `conversionService` -
  Returns:

### setProperty

    public void setProperty(PersistentProperty<?> property,
                            Object value)
                     throws IllegalAccessException,
                            InvocationTargetException

  Sets the given `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.

  Parameters:
    `property` -
    `value` -
  Throws:
    `IllegalAccessException`
    `InvocationTargetException`

### setProperty

    public void setProperty(PersistentProperty<?> property,
                            Object value,
                            boolean fieldAccessOnly)
                     throws IllegalAccessException,
                            InvocationTargetException

  Sets the given `PersistentProperty` to the given value. Will do type conversion if a `ConversionService` is configured.

  Parameters:
    `property` -
    `value` -
  Throws:
    `IllegalAccessException`
    `InvocationTargetException`

### getProperty

    public Object getProperty(PersistentProperty<?> property)
                       throws IllegalAccessException,
                              InvocationTargetException

  Returns the value of the given `PersistentProperty` of the underlying bean instance.

  Type Parameters:
    `S` -
  Parameters:
    `property` -
  Returns:
  Throws:
    `IllegalAccessException`
    `InvocationTargetException`

### getProperty

    public <S> S getProperty(PersistentProperty<?> property,
                             Class<? extends S> type,
                             boolean fieldAccessOnly)
                  throws IllegalAccessException,
                         InvocationTargetException

  Returns the value of the given `PersistentProperty` potentially converted to the given type.

  Type Parameters:
    `S` -
  Parameters:
    `property` -
    `type` -
    `fieldAccessOnly` -
  Returns:
  Throws:
    `IllegalAccessException`
    `InvocationTargetException`

### getBean

    public T getBean()

  Returns the underlying bean instance.

  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Spring Data Commons
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.