public class DefaultBeanWrapperFactory 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 |
---|
DefaultBeanWrapperFactory() |
Modifier and Type | Method and Description |
---|---|
BeanInstanceBuilder |
getBeanInstanceBuilder()
Obtains the builder that will be used to create bean instances every time a bean instantiation is needed.
|
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.
|
public BeanWrapperContext getBeanWrapperContext(Class clazz)
If the BeanWrapperContext is not in cache then creates a new one.
getBeanWrapperContext
in interface BeanWrapperFactory
clazz
- the bean class to inspectpublic BeanWrapperContext getBeanWrapperContext(Class clazz, Type... types)
If the BeanWrapperContext is not in cache then creates a new one.
getBeanWrapperContext
in interface BeanWrapperFactory
clazz
- 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 BeanWrapperFactory
clazz
- class to instantiate the wrapped beanJuffrouBeanWrapper.setValue(String, Object)
or JuffrouBeanWrapper.getBean()
public JuffrouBeanWrapper getBeanWrapper(Object instance)
Will try to use a cached BeanWrapperContext to save introspection time.
getBeanWrapper
in interface BeanWrapperFactory
instance
- the bean object to be wrappedpublic BeanInstanceBuilder getBeanInstanceBuilder()
BeanWrapperFactory
getBeanInstanceBuilder
in interface BeanWrapperFactory
Copyright © 2011–2020 Juffrou. All rights reserved.