net.sf.beanlib.provider
Class BeanPopulator
java.lang.Object
net.sf.beanlib.provider.BeanPopulator
- All Implemented Interfaces:
- BeanPopulatorBaseSpi, BeanPopulatorSpi
@NotThreadSafe
public class BeanPopulator
- extends Object
- implements BeanPopulatorSpi
Bean Populator.
- Author:
- Joe D. Velopar
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
factory
public static final BeanPopulator.Factory factory
log
private final Log log
fromBean
private final Object fromBean
toBean
private final Object toBean
baseConfig
private BeanPopulatorBaseConfig baseConfig
transformer
private Transformable transformer
BeanPopulator
private BeanPopulator(Object fromBean,
Object toBean)
- Parameters:
fromBean - from beantoBean - to bean
newBeanPopulator
public static BeanPopulator newBeanPopulator(Object from,
Object to)
getTransformerSpi
private BeanTransformerSpi getTransformerSpi()
populate
public <T> T populate()
- Returns the to-bean with setter methods invoked with values retreived
from the getter methods of the from-bean.
- Specified by:
populate in interface BeanPopulatorSpi
processSetterMethod
private void processSetterMethod(Method setterMethod)
- Processes a specific setter method for the toBean.
- Parameters:
setterMethod - a specific method of the toBean
doit
private <T> void doit(Method setterMethod,
Method readerMethod,
Class<T> paramType,
String propertyName)
invokeMethodAsPrivileged
private Object invokeMethodAsPrivileged(Object target,
Method method,
Object[] args)
- Invoke the given method as a privileged action, if necessary.
- Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException
initBeanPopulatable
public BeanPopulator initBeanPopulatable(BeanPopulatable beanPopulatable)
- Specified by:
initBeanPopulatable in interface BeanPopulatorBaseSpi- Specified by:
initBeanPopulatable in interface BeanPopulatorSpi
- Parameters:
beanPopulatable - optionally used to control if a specific value read should get populated across
initBeanSourceHandler
public BeanPopulator initBeanSourceHandler(BeanSourceHandler beanSourceHandler)
- Specified by:
initBeanSourceHandler in interface BeanPopulatorBaseSpi- Specified by:
initBeanSourceHandler in interface BeanPopulatorSpi
- Parameters:
beanSourceHandler - optionally used to do something with the value read before the population
initDebug
public BeanPopulator initDebug(boolean debug)
- Specified by:
initDebug in interface BeanPopulatorBaseSpi- Specified by:
initDebug in interface BeanPopulatorSpi
- Parameters:
debug - debug mode.
initDetailedBeanPopulatable
public BeanPopulator initDetailedBeanPopulatable(DetailedBeanPopulatable detailedBeanPopulatable)
- Specified by:
initDetailedBeanPopulatable in interface BeanPopulatorBaseSpi- Specified by:
initDetailedBeanPopulatable in interface BeanPopulatorSpi
- Parameters:
detailedBeanPopulatable - optionally used to override the population decisions.
initReaderMethodFinder
public BeanPopulator initReaderMethodFinder(BeanMethodFinder readerMethodFinder)
- Specified by:
initReaderMethodFinder in interface BeanPopulatorBaseSpi- Specified by:
initReaderMethodFinder in interface BeanPopulatorSpi
initSetterMethodCollector
public BeanPopulator initSetterMethodCollector(BeanMethodCollector setterMethodCollector)
- Specified by:
initSetterMethodCollector in interface BeanPopulatorBaseSpi- Specified by:
initSetterMethodCollector in interface BeanPopulatorSpi
getTransformer
public Transformable getTransformer()
- Specified by:
getTransformer in interface BeanPopulatorSpi
initTransformer
public BeanPopulator initTransformer(Transformable transformer)
- Specified by:
initTransformer in interface BeanPopulatorSpi
- Parameters:
transformer - optionally used to transform the value for the population
initBeanPopulationExceptionHandler
public BeanPopulator initBeanPopulationExceptionHandler(BeanPopulationExceptionHandler beanPopulationExceptionHandler)
- Specified by:
initBeanPopulationExceptionHandler in interface BeanPopulatorBaseSpi- Specified by:
initBeanPopulationExceptionHandler in interface BeanPopulatorSpi
initBeanPopulatorBaseConfig
public BeanPopulator initBeanPopulatorBaseConfig(BeanPopulatorBaseConfig baseConfig)
- Specified by:
initBeanPopulatorBaseConfig in interface BeanPopulatorBaseSpi- Specified by:
initBeanPopulatorBaseConfig in interface BeanPopulatorSpi