public class DefaultKeyConverter extends Object implements KeyConverter
KeyConverter for a given key class.
This KeyConverter implementation uses the following rules to
perform key conversion:
| Modifier and Type | Field and Description |
|---|---|
protected static DateFormat |
DATE_FORMAT
DateFormat instance that will be used to convert Date keys.
|
protected Class |
m_clzKey
Key class.
|
protected Constructor |
m_ctorFromString
Constructor to use for conversion from string.
|
protected Method |
m_methFromString
Static method to use for conversion from string.
|
protected static String[] |
METHODS
Method names that should be tried in order when looking for a method
that can be used for conversion from string.
|
| Constructor and Description |
|---|
DefaultKeyConverter(Class clzKey)
Construct a DefaultKeyConverter instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected Constructor |
findConstructor()
Find a key class constructor that accepts a single String argument.
|
protected Method |
findMethod(String sMethodName)
Find a static method with a specified name that accepts a single
String argument.
|
Object |
fromString(String sKey)
Convert a string representation of a key into its object form.
|
String |
toString(Object oKey)
Convert an object representation of a key into its string form.
|
protected final Class m_clzKey
protected final Constructor m_ctorFromString
protected final Method m_methFromString
protected static final String[] METHODS
protected static final DateFormat DATE_FORMAT
public DefaultKeyConverter(Class clzKey)
clzKey - key classpublic Object fromString(String sKey)
fromString in interface KeyConvertersKey - key as a stringpublic String toString(Object oKey)
toString in interface KeyConverteroKey - key in its original object formprotected Constructor findConstructor()