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 by(elements are separated byStringescaper for the separator isARRAY_ELEMENTS_SEPARATOR) to an array of specified type (methodARRAY_ELEMENTS_SEPARATOR_ESCAPER).parse(String)
Also it provides the back convertion from specified type to a, in outcome result elements will separated byString(methodARRAY_ELEMENTS_SEPARATOR).format(Object)
-
-
Constructor Summary
Constructors Constructor Description ArrayFormatter(IFormatter elementFormat)
-
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)
- 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 separated byStringARRAY_ELEMENTS_SEPARATOR. Null safety.- 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()
-
-