public final class FormatUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Map<Class<? extends Serializable>,SerializableFormat<? extends Serializable>> |
getAvailableFormatters()
Returns the available serializable formatters.
|
static <T extends Serializable> |
getFormattedValue(Class<T> type,
T object) |
static <T extends Serializable> |
getFormattedValue(Class<T> type,
T object,
DateFormat dateFormat) |
static <T extends Serializable> |
getParsedValue(Class<T> returnType,
String value)
Returns the parsed object of the given type for the given string.
|
static <T extends Serializable> |
getParsedValue(Class<T> returnType,
String value,
DateFormat dateFormat)
Returns the parsed object of the given type for the given string.
|
static boolean |
isParseableType(Class<?> type)
This method checks if the given type is a parseable type.
|
public static Map<Class<? extends Serializable>,SerializableFormat<? extends Serializable>> getAvailableFormatters()
public static boolean isParseableType(Class<?> type)
SerializableFormat implementation that
can be used for conversion. IntegerLongDoubleFloatBooleanCharacterByteShortStringBigDecimalBigIntegerDateCalendarLocaleTimeZoneCurrencyClasstype - The type to be checked if parseablepublic static <T extends Serializable> T getParsedValue(Class<T> returnType, String value) throws ParseException
getParsedValue(java.lang.Class, java.lang.String, java.text.DateFormat)
and the 3rd argument new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")returnType - The type to which the value should be parsedvalue - The string that should be parsedParseException - Is thrown when the string can not be parsedisParseableType(java.lang.Class),
getParsedValue(Class, String, java.text.DateFormat)public static <T extends Serializable> T getParsedValue(Class<T> returnType, String value, DateFormat dateFormat) throws ParseException
SerializableFormats an instance is choosen
based on the class object. The parsing of the string value may fail,
throwing a ParseException.returnType - The type to which the value should be parsedvalue - The string that should be parseddateFormat - The date format which should be used for string to
date/calendar conversionParseException - Is thrown when the string can not be parsedisParseableType(java.lang.Class)public static <T extends Serializable> String getFormattedValue(Class<T> type, T object)
public static <T extends Serializable> String getFormattedValue(Class<T> type, T object, DateFormat dateFormat)
Copyright © 2020 Blazebit. All rights reserved.