public class BeanWrapperContext extends Object
Performs introspection and holds metadata information about a class used by the BeanWrapper.
If you have to create several BeanWrappers for the same java class, use this and save the introspection overhead.
This class is thread safe.
| Constructor and Description |
|---|
BeanWrapperContext(Class clazz) |
BeanWrapperContext(Class clazz,
Type... types) |
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getBeanClass()
Get the wrapped bean class
|
BeanContextCreator<? extends BeanWrapperContext> |
getBeanContextCreator() |
BeanFieldHandler |
getBeanFieldHandler(String propertyName) |
Map<String,BeanFieldHandler> |
getFields() |
BeanWrapperContext |
getNestedContext(String thisProperty)
Obtains the BeanWrapperContext that corresponds to the bean type of this property type.
|
Type |
getType(String propertyName)
Gets the type of a property in the wrapped bean.
|
Map<TypeVariable<?>,Type> |
getTypeArgumentsMap() |
boolean |
isEagerInstatiation() |
Object |
newBeanInstance() |
void |
setBeanContextCreator(BeanContextCreator<? extends BeanWrapperContext> beanContextCreator) |
void |
setBeanInstanceCreator(BeanInstanceCreator beanInstanceCreator)
The bean wrapper creates new instances using Class.newIntance().
|
void |
setEagerInstatiation(boolean eager)
Defines when a new instance is created.
If eager is true, a new instance is created when the BeanWrapper is created and reset. |
public BeanWrapperContext(Class clazz)
public BeanWrapperContext getNestedContext(String thisProperty)
thisProperty - property name in this bean wrapper context (bean class). It must be of bean type.public BeanFieldHandler getBeanFieldHandler(String propertyName)
public Type getType(String propertyName)
getType("pro1.prop2") will get the type of prop2 from the nested bean referenced by
prop1.propertyName - public Class<?> getBeanClass()
public Object newBeanInstance()
public Map<String,BeanFieldHandler> getFields()
public Map<TypeVariable<?>,Type> getTypeArgumentsMap()
public void setBeanInstanceCreator(BeanInstanceCreator beanInstanceCreator)
beanInstanceCreator - public BeanContextCreator<? extends BeanWrapperContext> getBeanContextCreator()
public void setBeanContextCreator(BeanContextCreator<? extends BeanWrapperContext> beanContextCreator)
public boolean isEagerInstatiation()
public void setEagerInstatiation(boolean eager)
eagerInstatiation - Copyright © 2011-2013. All Rights Reserved.