public class CustomizableBeanWrapperFactory extends Object implements BeanWrapperFactory
A BeanWrapper uses the same BeanWrapperFactory to create the BeanWrapperContexts for its nested BeanWrappers. BeanWrapperFactory can also be used as an umbrella to create BeanWrappers in a more performant way as it caches the introspection information and re-uses it whenever possible.
| Constructor and Description |
|---|
CustomizableBeanWrapperFactory() |
| Modifier and Type | Method and Description |
|---|---|
BeanInstanceBuilder |
getBeanInstanceBuilder() |
JuffrouBeanWrapper |
getBeanWrapper(Class clazz)
Construct a bean wrapper around a class.
|
JuffrouBeanWrapper |
getBeanWrapper(Object instance)
Construct a bean wrapper around an existing bean instance.
|
BeanWrapperContext |
getBeanWrapperContext(Class clazz)
Retrieves a BeanWrapperContext for java bean class.
|
BeanWrapperContext |
getBeanWrapperContext(Class clazz,
Type... types)
Retrieves a BeanWrapperContext for a parameterized (generic) java bean class.
|
void |
setBeanContextBuilder(BeanContextBuilder beanContextBuilder)
Control the creation of BeanWrapperContexts.
|
void |
setBeanInstanceBuilder(BeanInstanceBuilder beanInstanceBuilder)
Control the instantiation of beans and wrapped beans.
|
public BeanWrapperContext getBeanWrapperContext(Class clazz)
If the BeanWrapperContext is not in cache then creates a new one.
getBeanWrapperContext in interface BeanWrapperFactoryclazz - the bean class to inspect#getBeanWrapperContext(Class, Type...)}public BeanWrapperContext getBeanWrapperContext(Class clazz, Type... types)
If the BeanWrapperContext is not in cache then creates a new one.
getBeanWrapperContext in interface BeanWrapperFactoryclazz - the generic bean class to inspect.types - the parameters that defined the generic bean class.public JuffrouBeanWrapper getBeanWrapper(Class clazz)
Bean instances will be instances of that class and will be created only when necessary.
Try to use a cached BeanWrapperContext to save introspection time.
getBeanWrapper in interface BeanWrapperFactoryclazz - class to instantiate the wrapped beanpublic JuffrouBeanWrapper getBeanWrapper(Object instance)
Will try to use a cached BeanWrapperContext to save introspection time.
getBeanWrapper in interface BeanWrapperFactoryinstance - the bean object to be wrappedpublic BeanInstanceBuilder getBeanInstanceBuilder()
getBeanInstanceBuilder in interface BeanWrapperFactorypublic void setBeanInstanceBuilder(BeanInstanceBuilder beanInstanceBuilder)
The bean wrapper creates new instances using Class.newIntance() by default. You can use this this if you want to create class instances yourself.
beanInstanceBuilder - public void setBeanContextBuilder(BeanContextBuilder beanContextBuilder)
Provide a custom BeanContextBuilder that will instantiate your custom BeanWrapperContext. This way you can extend the BeanWrapperContext class and attach more information to a bean.
beanContextBuilder - Copyright © 2011-2013. All Rights Reserved.