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 Object
fromString
(int i, String s, ConverterContext context) 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) 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:ObjectConverter
Converts from object to String based on current locale.- Specified by:
toString
in interfaceObjectConverter
- Parameters:
object
- object to be convertedcontext
- converter context to be used- Returns:
- the String
-
supportToString
Description copied from interface:ObjectConverter
If it supports toString method.- Specified by:
supportToString
in interfaceObjectConverter
- Parameters:
object
- object to be convertedcontext
- converter context to be used- Returns:
- true if supports toString
-
fromString
Description copied from interface:ObjectConverter
Converts from String to an object.- Specified by:
fromString
in interfaceObjectConverter
- Parameters:
string
- the stringcontext
- context to be converted- Returns:
- the object converted from string
-
supportFromString
Description copied from interface:ObjectConverter
If it supports fromString.- Specified by:
supportFromString
in interfaceObjectConverter
- Parameters:
string
- the stringcontext
- context to be converted- Returns:
- true if it supports
-