net.sf.ezmorph.bean

Class BeanMorpher

public final class BeanMorpher extends Object implements ObjectMorpher

Converts a JavaBean into another JavaBean or DynaBean.
This Morpher will try to match every property from the target JavaBean's class to the properties of the source JavaBean. If any target property differs in type from the source property, it will try to morph it. If a Morpher is not found for that type, the conversion will be aborted with a MorphException; this may be changed by setting the Morpher to be lenient, in that way it will ignore the property (the resulting value will be null).

Author: Andres Almiray

Constructor Summary
BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry)
BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry, boolean lenient)
Method Summary
Objectmorph(Object sourceBean)
ClassmorphsTo()
booleansupports(Class clazz)

Constructor Detail

BeanMorpher

public BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry)

Parameters: beanClass the target class to morph to morpherRegistry a registry of morphers

BeanMorpher

public BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry, boolean lenient)

Parameters: beanClass the target class to morph to morpherRegistry a registry of morphers lenient if an exception should be raised if no morpher is found for a target property

Method Detail

morph

public Object morph(Object sourceBean)

morphsTo

public Class morphsTo()

supports

public boolean supports(Class clazz)
Copyright © 2006-2010. All Rights Reserved.