public class RangeConverter extends Object implements ObjectConverter
| Modifier and Type | Field and Description |
|---|---|
static ConverterContext |
CONTEXT_MULTIPLE |
static ConverterContext |
CONTEXT_RANGE |
| Constructor and Description |
|---|
RangeConverter(Class<?> elementClass)
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) |
Object |
fromString(String string,
ConverterContext context)
Converts from String to an object.
|
boolean |
supportFromString(String string,
ConverterContext context)
If it supports fromString.
|
boolean |
supportToString(Object object,
ConverterContext context)
If it supports toString method.
|
protected String |
toString(int i,
Object o,
ConverterContext context) |
String |
toString(Object object,
ConverterContext context)
Converts from object to String based on current locale.
|
public static final ConverterContext CONTEXT_RANGE
public static final ConverterContext CONTEXT_MULTIPLE
public RangeConverter(Class<?> elementClass)
elementClass - class of the array element. Assume all elements have the same class type. If not, use the
constructor which takes Class>[] as parameter.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 String toString(Object object, ConverterContext context)
ObjectConvertertoString in interface ObjectConverterobject - object to be convertedcontext - converter context to be usedpublic boolean supportToString(Object object, ConverterContext context)
ObjectConvertersupportToString in interface ObjectConverterobject - object to be convertedcontext - converter context to be usedpublic Object fromString(String string, ConverterContext context)
ObjectConverterfromString in interface ObjectConverterstring - the stringcontext - context to be convertedpublic boolean supportFromString(String string, ConverterContext context)
ObjectConvertersupportFromString in interface ObjectConverterstring - the stringcontext - context to be convertedCopyright © 2017. All rights reserved.