Package org.openl.rules.table.formatters
Class FormattersManager
- java.lang.Object
-
- org.openl.rules.table.formatters.FormattersManager
-
public final class FormattersManager extends Object
Manager to get the formatters for convertions fromObjectvalues toStringand vice versa.- Author:
- DLiauchuk
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DATE_FORMATstatic StringDEFAULT_NUMBER_FORMAT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringformat(Object value)Returns String presentation of the given object.static IFormattergetFormatter(Class<?> clazz)static IFormattergetFormatter(Class<?> clazz, String format)The method used for getting the appropriate formatter for the income class.
-
-
-
Field Detail
-
DEFAULT_DATE_FORMAT
public static final String DEFAULT_DATE_FORMAT
- See Also:
- Constant Field Values
-
DEFAULT_NUMBER_FORMAT
public static final String DEFAULT_NUMBER_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
public static String format(Object value)
Returns String presentation of the given object. This method do a little bit more than Java's toString(). It returns a human readable string for Enums, Arrays, Booleans, Dates...- Parameters:
value- an object to format- Returns:
- String presentation of the object
- See Also:
getFormatter(Object)
-
getFormatter
public static IFormatter getFormatter(Class<?> clazz, String format)
The method used for getting the appropriate formatter for the income class. If no formatter found it will be returnedDefaultFormatteras default.
Existing formatters:NumberFormatterfor numeric types.DateFormatterforDatetype.BooleanFormatterforBooleantype.EnumFormatterfor Enum types.ArrayFormatterfor array types, also supports primitive arrays.DefaultFormatterforStringtype.
- Parameters:
clazz- formatter will be returned for thisClass.format- format for number, date formatters. Ifnulldefault format will be usedDEFAULT_NUMBER_FORMATandDEFAULT_DATE_FORMATaccordingly.- Returns:
- formatter for a type.
-
getFormatter
public static IFormatter getFormatter(Class<?> clazz)
-
-