类 NumberMorpher
java.lang.Object
com.sh.json.ezmorph.object.AbstractObjectMorpher
com.sh.json.ezmorph.object.NumberMorpher
- 所有已实现的接口:
Morpher,ObjectMorpher
Morphs to a subclass of Number.
Supported types are - Byte, Short, Integer, Long, Float, BigInteger, BigtDecimal.
Supported types are - Byte, Short, Integer, Long, Float, BigInteger, BigtDecimal.
-
构造器概要
构造器构造器说明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. -
方法概要
修饰符和类型方法说明booleanReturns the default value for this Morpher.inthashCode()Morphs the input object into an output object of the supported type.Class<?>morphsTo()Returns the target Class for conversion.voidsetDefaultValue(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 withmorphsTo().从类继承的方法 com.sh.json.ezmorph.object.AbstractObjectMorpher
isUseDefault, setUseDefault, supports
-
构造器详细资料
-
NumberMorpher
Creates a new morpher for the target type.- 参数:
type- must be a primitive or wrapper type. BigDecimal and BigInteger are also supported.
-
NumberMorpher
Creates a new morpher for the target type with a default value.
The defaultValue should be of the same class as the target type.- 参数:
type- must be a primitive or wrapper type. BigDecimal and BigInteger are also supported.defaultValue- return value if the value to be morphed is null
-
-
方法详细资料
-
equals
-
getDefaultValue
Returns the default value for this Morpher. -
hashCode
public int hashCode() -
morph
从接口复制的说明:ObjectMorpherMorphs the input object into an output object of the supported type.- 参数:
value- The input value to be morphed
-
morphsTo
从接口复制的说明:MorpherReturns the target Class for conversion.- 返回:
- the target Class for conversion.
-
setDefaultValue
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 withmorphsTo().- 参数:
defaultValue- return value if the value to be morphed is null
-