public abstract class ArrayConverter extends Object implements ObjectConverter
| Constructor and Description |
|---|
ArrayConverter(String separator,
int size,
Class<?> elementClass)
Creates an ArrayConverter.
|
ArrayConverter(String separator,
int size,
Class<?>[] elementClasses)
Creates an ArrayConverter.
|
| Modifier and Type | Method and Description |
|---|---|
Object[] |
arrayFromString(String string,
ConverterContext context)
Converts from string to an array of objects, using separator to separate the string.
|
String |
arrayToString(Object[] objects,
ConverterContext context)
Converts from array to string by concating them with separators.
|
protected Object |
fromString(int i,
String s,
ConverterContext context) |
Class<?> |
getElementClass()
Gets the element class for the array.
|
boolean |
isUseTokenizer()
Gets the flag indicating if the converter will utilize Tokenizer to split the string or just utilize String#split().
|
void |
setUseTokenizer(boolean useTokenizer)
Sets the flag indicating if the converter will utilize Tokenizer to split the string or just utilize String#split().
|
protected String |
toString(int i,
Object o,
ConverterContext context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfromString, supportFromString, supportToString, toStringpublic ArrayConverter(String separator, int size, Class<?> elementClass)
separator - separator to separate values. It should contain at least non-empty character.size - size of the arrayelementClass - class of the array element. Assume all elements have the same class type. If not, use the
constructor which takes Class>[] as parameter.public ArrayConverter(String separator, int size, Class<?>[] elementClasses)
separator - separator to separate values. It should contain at least non-empty character.size - size of the arrayelementClasses - classes of the array element. The length must be the same as size. If not,
IllegalArgumentException will be thrown.public String arrayToString(Object[] objects, ConverterContext context)
objects - an array of objectscontext - converter contextprotected String toString(int i, Object o, ConverterContext context)
public Object[] arrayFromString(String string, ConverterContext context)
string - string to be convertedcontext - converter contextprotected Object fromString(int i, String s, ConverterContext context)
public Class<?> getElementClass()
public boolean isUseTokenizer()
setUseTokenizer(boolean)public void setUseTokenizer(boolean useTokenizer)
useTokenizer - the flagCopyright © 2017. All rights reserved.