|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.util.CmsDataTypeUtil
public final class CmsDataTypeUtil
Utilities to handle basic data types.
Method Summary | |
---|---|
static java.lang.Object |
dataDeserialize(byte[] data,
java.lang.String type)
Returns the deserialized (if needed) object. |
static java.lang.String |
dataExport(java.lang.Object data)
Returns a ready to export string representation of the given object. |
static java.lang.Object |
dataImport(java.lang.String value,
java.lang.String type)
Returns the import data object. |
static byte[] |
dataSerialize(java.lang.Object data)
Serialize the given data. |
static java.lang.String |
format(boolean data)
Formats the given data into a string value. |
static java.lang.String |
format(byte data)
Formats the given data into a string value. |
static java.lang.String |
format(char data)
Formats the given data into a string value. |
static java.lang.String |
format(java.util.Date data)
Formats the given data into a string value. |
static java.lang.String |
format(double data)
Formats the given data into a string value. |
static java.lang.String |
format(float data)
Formats the given data into a string value. |
static java.lang.String |
format(int data)
Formats the given data into a string value. |
static java.lang.String |
format(long data)
Formats the given data into a string value. |
static java.lang.String |
format(java.lang.Object data)
Formats the given data into a string value depending on the data type. |
static java.lang.String |
format(short data)
Formats the given data into a string value. |
static boolean |
isParseable(java.lang.Class clazz)
Checks if the given class is representable as a string. |
static java.lang.Object |
parse(java.lang.String data,
java.lang.Class clazz)
Returns an object of the given type (or a wrapper for base types) with the value of the given data. |
static java.lang.Boolean |
parseBoolean(java.lang.String data)
Parses the given data as a boolean. |
static java.lang.Byte |
parseByte(java.lang.String data)
Parses the given data as a byte. |
static java.lang.Character |
parseChar(java.lang.String data)
Parses the given data as a char. |
static java.util.Date |
parseDate(java.lang.String data)
Parses the given data as a date. |
static java.lang.Double |
parseDouble(java.lang.String data)
Parses the given data as a double. |
static java.lang.Float |
parseFloat(java.lang.String data)
Parses the given data as a float. |
static java.lang.Integer |
parseInt(java.lang.String data)
Parses the given data as an integer. |
static java.lang.Long |
parseLong(java.lang.String data)
Parses the given data as a long. |
static java.lang.Short |
parseShort(java.lang.String data)
Parses the given data as a short. |
static CmsUUID |
parseUUID(java.lang.String data)
Parses the given data as an uuid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.Object dataDeserialize(byte[] data, java.lang.String type) throws java.io.IOException, java.lang.ClassNotFoundException
data
- the data to deserializetype
- the data type
java.io.IOException
- if the inputstream fails
java.lang.ClassNotFoundException
- if the serialized object failspublic static java.lang.String dataExport(java.lang.Object data) throws java.io.IOException
For not parseable objects, base64 encoded string with the serialized object is generated.
data
- the object to export
java.io.IOException
- if something goes wrongpublic static java.lang.Object dataImport(java.lang.String value, java.lang.String type) throws java.lang.ClassNotFoundException, java.io.IOException
value
- the exported valuetype
- the expected data type
java.lang.ClassNotFoundException
- if something goes wrong
java.io.IOException
- if something goes wrongpublic static byte[] dataSerialize(java.lang.Object data) throws java.io.IOException
data
- the data to serialize
java.io.IOException
- if something goes wrongpublic static java.lang.String format(boolean data)
data
- the data to format
public static java.lang.String format(byte data)
data
- the data to format
public static java.lang.String format(char data)
data
- the data to format
public static java.lang.String format(java.util.Date data)
data
- the data to format
public static java.lang.String format(double data)
data
- the data to format
public static java.lang.String format(float data)
data
- the data to format
public static java.lang.String format(int data)
data
- the data to format
public static java.lang.String format(long data)
data
- the data to format
public static java.lang.String format(java.lang.Object data)
data
- the data to format
public static java.lang.String format(short data)
data
- the data to format
public static boolean isParseable(java.lang.Class clazz)
clazz
- the type to test
public static java.lang.Object parse(java.lang.String data, java.lang.Class clazz)
data
- the data to parseclazz
- the data type
public static java.lang.Boolean parseBoolean(java.lang.String data)
data
- the data to parse
public static java.lang.Byte parseByte(java.lang.String data)
data
- the data to parse
public static java.lang.Character parseChar(java.lang.String data)
data
- the data to parse
public static java.util.Date parseDate(java.lang.String data)
data
- the data to parse
public static java.lang.Double parseDouble(java.lang.String data)
data
- the data to parse
public static java.lang.Float parseFloat(java.lang.String data)
data
- the data to parse
public static java.lang.Integer parseInt(java.lang.String data)
data
- the data to parse
public static java.lang.Long parseLong(java.lang.String data)
data
- the data to parse
public static java.lang.Short parseShort(java.lang.String data)
data
- the data to parse
public static CmsUUID parseUUID(java.lang.String data)
data
- the data to parse
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |