Package net.sf.jasperreports.engine.util
Class JRValueStringUtils
- java.lang.Object
-
- net.sf.jasperreports.engine.util.JRValueStringUtils
-
public final class JRValueStringUtils extends Object
Utility class used to serialize/deserialize value objects to/from String values.Specific logic is used to convert to and from Strings values of the following types:
java.lang.String
java.lang.Character
java.lang.Boolean
java.lang.Byte
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
java.math.BigInteger
java.math.BigDecimal
java.util.Date
java.sql.Timestamp
java.sql.Time
Object of other types are serialized and the resulting binary data is converted into a String using the BASE64 encoding.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_MESSAGE_KEY_ERROR_PARSING_DATA
static String
EXCEPTION_MESSAGE_KEY_VALUE_NOT_SERIALIZABLE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
deserialize(String valueClass, String data)
Converts a String back into a value.protected static JRValueStringUtils.ValueSerializer
getSerializer(String valueClass)
static boolean
hasSerializer(String valueClass)
Determines if there's a built-in serializer for the value type.static String
serialize(String valueClass, Object value)
Converts a value into a String representation.
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_ERROR_PARSING_DATA
public static final String EXCEPTION_MESSAGE_KEY_ERROR_PARSING_DATA
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_VALUE_NOT_SERIALIZABLE
public static final String EXCEPTION_MESSAGE_KEY_VALUE_NOT_SERIALIZABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
hasSerializer
public static boolean hasSerializer(String valueClass)
Determines if there's a built-in serializer for the value type.- Parameters:
valueClass
- the value type- Returns:
- whether the value type is handled by a built-in serializer
-
serialize
public static String serialize(String valueClass, Object value)
Converts a value into a String representation.- Parameters:
valueClass
- the type of the valuevalue
- the value- Returns:
- the String representation of the value
-
deserialize
public static Object deserialize(String valueClass, String data)
Converts a String back into a value.- Parameters:
valueClass
- the type of the valuedata
- the String representation of the value- Returns:
- the value
-
getSerializer
protected static JRValueStringUtils.ValueSerializer getSerializer(String valueClass)
-
-