Package org.codehaus.jettison.mapped
Class DefaultConverter
- java.lang.Object
-
- org.codehaus.jettison.mapped.DefaultConverter
-
- All Implemented Interfaces:
TypeConverter
public class DefaultConverter extends java.lang.Object implements TypeConverter
Default converter that tries to convert value to appropriate primitive (if fails, returns original string)- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description static booleanENFORCE_32BIT_INTEGERprivate static java.lang.StringENFORCE_32BIT_INTEGER_KEYprivate booleanenforce32BitIntprivate static intMAX_LENGTH_INTEGERprivate static intMAX_LENGTH_INTEGER_NEGATIVEprivate static intMAX_LENGTH_LONGprivate static intMAX_LENGTH_LONG_NEGATIVE
-
Constructor Summary
Constructors Constructor Description DefaultConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertToJSONPrimitive(java.lang.String text)private static java.lang.DoublegetDouble(java.lang.String text)Try to get a Double value efficiently, avoiding Exceptionsprivate static java.lang.IntegergetInteger(java.lang.String text)Try to get an Integer value efficiently, avoiding Exceptionsprivate static java.lang.LonggetLong(java.lang.String text)Try to get a Long value efficiently, avoiding ExceptionsvoidsetEnforce32BitInt(boolean enforce32BitInt)
-
-
-
Field Detail
-
ENFORCE_32BIT_INTEGER_KEY
private static final java.lang.String ENFORCE_32BIT_INTEGER_KEY
- See Also:
- Constant Field Values
-
ENFORCE_32BIT_INTEGER
public static final boolean ENFORCE_32BIT_INTEGER
-
enforce32BitInt
private boolean enforce32BitInt
-
MAX_LENGTH_LONG
private static final int MAX_LENGTH_LONG
-
MAX_LENGTH_LONG_NEGATIVE
private static final int MAX_LENGTH_LONG_NEGATIVE
-
MAX_LENGTH_INTEGER
private static final int MAX_LENGTH_INTEGER
-
MAX_LENGTH_INTEGER_NEGATIVE
private static final int MAX_LENGTH_INTEGER_NEGATIVE
-
-
Method Detail
-
setEnforce32BitInt
public void setEnforce32BitInt(boolean enforce32BitInt)
-
convertToJSONPrimitive
public java.lang.Object convertToJSONPrimitive(java.lang.String text)
- Specified by:
convertToJSONPrimitivein interfaceTypeConverter
-
getLong
private static java.lang.Long getLong(java.lang.String text)
Try to get a Long value efficiently, avoiding Exceptions
-
getInteger
private static java.lang.Integer getInteger(java.lang.String text)
Try to get an Integer value efficiently, avoiding Exceptions
-
getDouble
private static java.lang.Double getDouble(java.lang.String text)
Try to get a Double value efficiently, avoiding Exceptions
-
-