|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.converter.ArrayConverter
public abstract class ArrayConverter
An abstract class that is extended by any converters that convert to/from an array-like format, such as 1, 2, 3.
Examples are Point. Point(100, 200) can convert to/from "100, 200"
You have the choice of what the separator is;
separator is the ", " in the Point example above.
Constructor Summary | |
---|---|
ArrayConverter(String separator,
int size,
Class<?> elementClass)
Creates an ArrayConverter. |
|
ArrayConverter(String separator,
int size,
Class<?>[] elementClasses)
Creates an ArrayConverter. |
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jidesoft.converter.ObjectConverter |
---|
fromString, supportFromString, supportToString, toString |
Constructor Detail |
---|
public 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.Method Detail |
---|
public String arrayToString(Object[] objects, ConverterContext context)
objects
- an array of objectscontext
- converter context
protected String toString(int i, Object o, ConverterContext context)
public Object[] arrayFromString(String string, ConverterContext context)
string
- string to be convertedcontext
- converter context
protected Object fromString(int i, String s, ConverterContext context)
public Class<?> getElementClass()
public boolean isUseTokenizer()
setUseTokenizer(boolean)
public void setUseTokenizer(boolean useTokenizer)
useTokenizer
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |