|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ezmorph.bean.BeanMorpher
public final class BeanMorpher
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).
Constructor Summary | |
---|---|
BeanMorpher(Class beanClass,
MorpherRegistry morpherRegistry)
|
|
BeanMorpher(Class beanClass,
MorpherRegistry morpherRegistry,
boolean lenient)
|
Method Summary | |
---|---|
Object |
morph(Object sourceBean)
Morphs the input object into an output object of the supported type. |
Class |
morphsTo()
Returns the target Class for conversion. |
boolean |
supports(Class clazz)
Returns true if the Morpher supports conversion from this Class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry)
beanClass
- the target class to morph tomorpherRegistry
- a registry of morpherspublic BeanMorpher(Class beanClass, MorpherRegistry morpherRegistry, boolean lenient)
beanClass
- the target class to morph tomorpherRegistry
- a registry of morpherslenient
- if an exception should be raised if no morpher is found for
a target propertyMethod Detail |
---|
public Object morph(Object sourceBean)
ObjectMorpher
morph
in interface ObjectMorpher
sourceBean
- The input value to be morphedpublic Class morphsTo()
Morpher
morphsTo
in interface Morpher
public boolean supports(Class clazz)
Morpher
supports
in interface Morpher
clazz
- the source Class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |