Morpher
, ObjectMorpher
public final class NumberMorpher extends AbstractObjectMorpher
Constructor | Description |
---|---|
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. |
Modifier and Type | Method | Description |
---|---|---|
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() . |
isUseDefault, setUseDefault, supports
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 nullpublic Number getDefaultValue()
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 nullCopyright © 2006–2019. All rights reserved.