Package com.jidesoft.converter
Class RangeConverter
java.lang.Object
com.jidesoft.converter.RangeConverter
- All Implemented Interfaces:
ObjectConverter
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.
You have the choice of what the separator is; separator is the ", " in the Point example above.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]arrayFromString(String string, ConverterContext context) Converts from string to an array of objects, using separator to separate the string.arrayToString(Object[] objects, ConverterContext context) Converts from array to string by concating them with separators.protected ObjectfromString(int i, String s, ConverterContext context) fromString(String string, ConverterContext context) Converts from String to an object.booleansupportFromString(String string, ConverterContext context) If it supports fromString.booleansupportToString(Object object, ConverterContext context) If it supports toString method.protected StringtoString(int i, Object o, ConverterContext context) toString(Object object, ConverterContext context) Converts from object to String based on current locale.
-
Field Details
-
CONTEXT_RANGE
-
CONTEXT_MULTIPLE
-
-
Constructor Details
-
RangeConverter
Creates an ArrayConverter.- Parameters:
elementClass- class of the array element. Assume all elements have the same class type. If not, use the constructor which takes Classinvalid input: '<'?>[] as parameter.
-
-
Method Details
-
arrayToString
Converts from array to string by concating them with separators.- Parameters:
objects- an array of objectscontext- converter context- Returns:
- string all objects concatenated with separators
-
toString
-
arrayFromString
Converts from string to an array of objects, using separator to separate the string.- Parameters:
string- string to be convertedcontext- converter context- Returns:
- the array
-
fromString
-
toString
Description copied from interface:ObjectConverterConverts from object to String based on current locale.- Specified by:
toStringin interfaceObjectConverter- Parameters:
object- object to be convertedcontext- converter context to be used- Returns:
- the String
-
supportToString
Description copied from interface:ObjectConverterIf it supports toString method.- Specified by:
supportToStringin interfaceObjectConverter- Parameters:
object- object to be convertedcontext- converter context to be used- Returns:
- true if supports toString
-
fromString
Description copied from interface:ObjectConverterConverts from String to an object.- Specified by:
fromStringin interfaceObjectConverter- Parameters:
string- the stringcontext- context to be converted- Returns:
- the object converted from string
-
supportFromString
Description copied from interface:ObjectConverterIf it supports fromString.- Specified by:
supportFromStringin interfaceObjectConverter- Parameters:
string- the stringcontext- context to be converted- Returns:
- true if it supports
-