|
JIDE Common Layer 2.7.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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(java.lang.String separator,
int size,
java.lang.Class<?> elementClass)
Creates an ArrayConverter. |
|
ArrayConverter(java.lang.String separator,
int size,
java.lang.Class<?>[] elementClasses)
Creates an ArrayConverter. |
Method Summary | |
---|---|
java.lang.Object[] |
arrayFromString(java.lang.String string,
ConverterContext context)
Converts from string to an array of objects, using separator to separate the string. |
java.lang.String |
arrayToString(java.lang.Object[] objects,
ConverterContext context)
Converts from array to string by concating them with separators. |
protected java.lang.Object |
fromString(int i,
java.lang.String s,
ConverterContext context)
|
java.lang.Class<?> |
getElementClass()
Gets the element class for the array. |
protected java.lang.String |
toString(int i,
java.lang.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(java.lang.String separator, int size, java.lang.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(java.lang.String separator, int size, java.lang.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 java.lang.String arrayToString(java.lang.Object[] objects, ConverterContext context)
objects
- an array of objectscontext
- converter context
protected java.lang.String toString(int i, java.lang.Object o, ConverterContext context)
public java.lang.Object[] arrayFromString(java.lang.String string, ConverterContext context)
string
- string to be convertedcontext
- converter context
protected java.lang.Object fromString(int i, java.lang.String s, ConverterContext context)
public java.lang.Class<?> getElementClass()
|
JIDE Common Layer 2.7.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |