|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.ezmorph.object.AbstractObjectMorpher net.sf.ezmorph.object.NumberMorpher
public final class NumberMorpher
Morphs to a subclass of Number.
Supported types are - Byte, Short, Integer, Long, Float, BigInteger,
BigtDecimal.
Constructor Summary | |
---|---|
NumberMorpher(Class type)
Creates a new morpher for the target type. |
|
NumberMorpher(Class type,
Number defaultValue)
Creates a new morpher for the target type with a default value. The defaultValue should be of the same class as the target type. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
Number |
getDefaultValue()
Returns the default value for this Morpher. |
int |
hashCode()
|
Object |
morph(Object value)
Morphs the input object into an output object of the supported type. |
Class |
morphsTo()
Returns the target Class for conversion. |
void |
setDefaultValue(Number defaultValue)
Sets the defaultValue to use if the value to be morphed is null. The defaultValue should be of the same class as the type this morpher returns with morphsTo() . |
Methods inherited from class net.sf.ezmorph.object.AbstractObjectMorpher |
---|
isUseDefault, setUseDefault, supports |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumberMorpher(Class type)
type
- must be a primitive or wrapper type. BigDecimal and BigInteger
are also supported.public NumberMorpher(Class type, Number defaultValue)
type
- must be a primitive or wrapper type. BigDecimal and BigInteger
are also supported.defaultValue
- return value if the value to be morphed is nullMethod Detail |
---|
public boolean equals(Object obj)
equals
in class Object
public Number getDefaultValue()
public int hashCode()
hashCode
in class Object
public Object morph(Object value)
ObjectMorpher
value
- The input value to be morphedpublic Class morphsTo()
Morpher
public void setDefaultValue(Number defaultValue)
morphsTo()
.
defaultValue
- return value if the value to be morphed is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |