|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.conversion.impl.DefaultTypeConverter
public class DefaultTypeConverter
Default type conversion. Converts among numeric types and also strings. Contains the basic type mapping code from OGNL.
Field Summary |
---|
Fields inherited from interface com.opensymphony.xwork2.conversion.TypeConverter |
---|
NO_CONVERSION_POSSIBLE, TYPE_CONVERTER_CONTEXT_KEY |
Constructor Summary | |
---|---|
DefaultTypeConverter()
|
Method Summary | |
---|---|
static java.math.BigDecimal |
bigDecValue(java.lang.Object value)
Evaluates the given object as a BigDecimal. |
static java.math.BigInteger |
bigIntValue(java.lang.Object value)
Evaluates the given object as a BigInteger. |
static boolean |
booleanValue(java.lang.Object value)
Evaluates the given object as a boolean: if it is a Boolean object, it's easy; if it's a Number or a Character, returns true for non-zero objects; and otherwise returns true for non-null objects. |
java.lang.Object |
convertValue(java.util.Map<java.lang.String,java.lang.Object> context,
java.lang.Object value,
java.lang.Class toType)
|
java.lang.Object |
convertValue(java.util.Map<java.lang.String,java.lang.Object> context,
java.lang.Object target,
java.lang.reflect.Member member,
java.lang.String propertyName,
java.lang.Object value,
java.lang.Class toType)
Converts the given value to a given type. |
java.lang.Object |
convertValue(java.lang.Object value,
java.lang.Class toType)
Returns the value converted numerically to the given class type This method also detects when arrays are being converted and converts the components of one array to the type of the other. |
static double |
doubleValue(java.lang.Object value)
Evaluates the given object as a double-precision floating-point number. |
java.lang.Enum<?> |
enumValue(java.lang.Class toClass,
java.lang.Object o)
|
TypeConverter |
getTypeConverter(java.util.Map<java.lang.String,java.lang.Object> context)
|
static long |
longValue(java.lang.Object value)
Evaluates the given object as a long integer. |
static java.lang.String |
stringValue(java.lang.Object value)
Evaluates the given object as a String. |
static java.lang.String |
stringValue(java.lang.Object value,
boolean trim)
Evaluates the given object as a String and trims it if the trim flag is true. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultTypeConverter()
Method Detail |
---|
public java.lang.Object convertValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.Object value, java.lang.Class toType)
public java.lang.Object convertValue(java.util.Map<java.lang.String,java.lang.Object> context, java.lang.Object target, java.lang.reflect.Member member, java.lang.String propertyName, java.lang.Object value, java.lang.Class toType)
TypeConverter
convertValue
in interface TypeConverter
context
- context under which the conversion is being donetarget
- target object in which the property is being setmember
- member (Constructor, Method or Field) being setpropertyName
- property name being setvalue
- value to be convertedtoType
- type to which value is converted
public TypeConverter getTypeConverter(java.util.Map<java.lang.String,java.lang.Object> context)
public java.lang.Object convertValue(java.lang.Object value, java.lang.Class toType)
value
- an object to be converted to the given typetoType
- class type to be converted to
public static boolean booleanValue(java.lang.Object value)
value
- an object to interpret as a boolean
public java.lang.Enum<?> enumValue(java.lang.Class toClass, java.lang.Object o)
public static long longValue(java.lang.Object value) throws java.lang.NumberFormatException
value
- an object to interpret as a long integer
java.lang.NumberFormatException
- if the given object can't be understood as a long integerpublic static double doubleValue(java.lang.Object value) throws java.lang.NumberFormatException
value
- an object to interpret as a double
java.lang.NumberFormatException
- if the given object can't be understood as a doublepublic static java.math.BigInteger bigIntValue(java.lang.Object value) throws java.lang.NumberFormatException
value
- an object to interpret as a BigInteger
java.lang.NumberFormatException
- if the given object can't be understood as a BigIntegerpublic static java.math.BigDecimal bigDecValue(java.lang.Object value) throws java.lang.NumberFormatException
value
- an object to interpret as a BigDecimal
java.lang.NumberFormatException
- if the given object can't be understood as a BigDecimalpublic static java.lang.String stringValue(java.lang.Object value, boolean trim)
value
- an object to interpret as a String
public static java.lang.String stringValue(java.lang.Object value)
value
- an object to interpret as a String
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |