T - the type of the objectS - the type of the value in the list.public abstract class ValuesConverter<T,S> extends DefaultObjectConverter<T> implements RequiringConverterManager
| Constructor and Description |
|---|
ValuesConverter(java.lang.String separator,
java.lang.Class<?> elementClass)
Creates an ArrayConverter.
|
ValuesConverter(java.lang.String separator,
java.lang.Class<?>[] elementClasses)
Creates an ArrayConverter.
|
| Modifier and Type | Method and Description |
|---|---|
protected S |
fromString(int i,
java.lang.String s,
ConverterContext context)
Converts the String to a value using the ObjectConverterManager.
|
java.lang.Class<?> |
getElementClass(int index)
Gets the element class for the value at the specified index.
|
static void |
main(java.lang.String[] args) |
protected java.lang.String |
toString(int i,
S o,
ConverterContext context)
Converts the value to String using the ObjectConverterManager.
|
java.util.List<S> |
valuesFromString(java.lang.String string,
ConverterContext context)
Converts from string to a list of values, using separator to separate the string.
|
java.lang.String |
valuesToString(java.util.List<S> objects,
ConverterContext context)
Converts from a list of values to string by concatenating them with separators.
|
fromString, fromString, getObjectConverterManager, toString, toString, toStringConverterpublic ValuesConverter(java.lang.String separator,
java.lang.Class<?> elementClass)
separator - separator to separate values. It should contain at least non-empty character.elementClass - class of the array element if all elements have the same class type.public ValuesConverter(java.lang.String separator,
java.lang.Class<?>[] elementClasses)
separator - separator to separate values. It should contain at least non-empty character.elementClasses - classes of the elements, if the elements in the list have different types. In this case,
you may have to a common super class as the generic type S. If there is no common super
class, use Object.public java.lang.String valuesToString(java.util.List<S> objects, ConverterContext context)
objects - a list of valuescontext - converter contextprotected java.lang.String toString(int i,
S o,
ConverterContext context)
i - the index of the value in the list.o - the valuecontext - the context.public java.util.List<S> valuesFromString(java.lang.String string, ConverterContext context)
string - string to be convertedcontext - the converter contextprotected S fromString(int i, java.lang.String s, ConverterContext context)
i - the index of the value in the list.s - the stringcontext - the context.public java.lang.Class<?> getElementClass(int index)
index - the index of the value in the values array.public static void main(java.lang.String[] args)