Package org.openl.rules.table.formatters
Class ArrayFormatter
- java.lang.Object
-
- org.openl.rules.table.formatters.ArrayFormatter
-
- All Implemented Interfaces:
IFormatter
public class ArrayFormatter extends Object implements IFormatter
A formatter for converting an array of elements, represented byto an array of specified type (methodString).parse(String)
Also it provides the back convertion from specified type to a, in outcome result elements will be separated by comma (methodString).format(Object)
-
-
Constructor Summary
Constructors Constructor Description ArrayFormatter(IFormatter elementFormat, Class<?> elementType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(Object value)Converts an input array of elements to.StringIFormattergetElementFormat()Objectparse(String value)
-
-
-
Constructor Detail
-
ArrayFormatter
public ArrayFormatter(IFormatter elementFormat, Class<?> elementType)
- Parameters:
elementFormat- formatter for the component type of array.
-
-
Method Detail
-
format
public String format(Object value)
Converts an input array of elements to. Elements in the return value will be separated by comma. Null safety.String- Specified by:
formatin interfaceIFormatter- Parameters:
value- array of elements that should be represented as.String- Returns:
representation of the income array.StringNULLif the income value isNULLor if income value is not an array.
-
parse
public Object parse(String value)
- Specified by:
parsein interfaceIFormatter- Parameters:
value-representation of the array.String- Returns:
- array of elements.
NULLif input is empty or can`t get the component type of the array.
-
getElementFormat
public IFormatter getElementFormat()
-
-