Package com.jidesoft.converter
Class RangeConverter
- java.lang.Object
-
- com.jidesoft.converter.RangeConverter
-
- All Implemented Interfaces:
ObjectConverter
public class RangeConverter extends java.lang.Object implements 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.
-
-
Field Summary
Fields Modifier and Type Field Description static ConverterContextCONTEXT_MULTIPLEstatic ConverterContextCONTEXT_RANGE
-
Constructor Summary
Constructors Constructor Description RangeConverter(java.lang.Class<?> elementClass)Creates an ArrayConverter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.StringarrayToString(java.lang.Object[] objects, ConverterContext context)Converts from array to string by concating them with separators.protected java.lang.ObjectfromString(int i, java.lang.String s, ConverterContext context)java.lang.ObjectfromString(java.lang.String string, ConverterContext context)Converts from String to an object.booleansupportFromString(java.lang.String string, ConverterContext context)If it supports fromString.booleansupportToString(java.lang.Object object, ConverterContext context)If it supports toString method.protected java.lang.StringtoString(int i, java.lang.Object o, ConverterContext context)java.lang.StringtoString(java.lang.Object object, ConverterContext context)Converts from object to String based on current locale.
-
-
-
Field Detail
-
CONTEXT_RANGE
public static final ConverterContext CONTEXT_RANGE
-
CONTEXT_MULTIPLE
public static final ConverterContext CONTEXT_MULTIPLE
-
-
Method Detail
-
arrayToString
public java.lang.String arrayToString(java.lang.Object[] objects, ConverterContext context)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
protected java.lang.String toString(int i, java.lang.Object o, ConverterContext context)
-
arrayFromString
public java.lang.Object[] arrayFromString(java.lang.String string, ConverterContext context)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
protected java.lang.Object fromString(int i, java.lang.String s, ConverterContext context)
-
toString
public java.lang.String toString(java.lang.Object object, ConverterContext context)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
public boolean supportToString(java.lang.Object object, ConverterContext context)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
public java.lang.Object fromString(java.lang.String string, ConverterContext context)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
public boolean supportFromString(java.lang.String string, ConverterContext context)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
-
-