Package com.tangosol.coherence.rest
Class DefaultKeyConverter
java.lang.Object
com.tangosol.coherence.rest.DefaultKeyConverter
- All Implemented Interfaces:
 KeyConverter
Default implementation of 
KeyConverter for a given key class.
 
 This KeyConverter implementation uses the following rules to
 perform key conversion:
 
- toString:
 - fromString:
     
- if the key class is java.util.Date, the given string needs to be formatted as yyyy-MM-dd;
 - otherwise, look for a constructor or a static fromString, valueOf or parse method (in that order) on the key class
 
 
- Author:
 - as 2011.06.08
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final DateFormatDateFormat instance that will be used to convert Date keys.protected final ClassKey class.protected final ConstructorConstructor to use for conversion from string.protected final MethodStatic method to use for conversion from string.protected static final String[]Method names that should be tried in order when looking for a method that can be used for conversion from string. - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected ConstructorFind a key class constructor that accepts a single String argument.protected MethodfindMethod(String sMethodName) Find a static method with a specified name that accepts a single String argument.fromString(String sKey) Convert a string representation of a key into its object form.Convert an object representation of a key into its string form. 
- 
Field Details
- 
m_clzKey
Key class. - 
m_ctorFromString
Constructor to use for conversion from string. - 
m_methFromString
Static method to use for conversion from string. - 
METHODS
Method names that should be tried in order when looking for a method that can be used for conversion from string. - 
DATE_FORMAT
DateFormat instance that will be used to convert Date keys. 
 - 
 - 
Constructor Details
- 
DefaultKeyConverter
Construct a DefaultKeyConverter instance.- Parameters:
 clzKey- key class
 
 - 
 - 
Method Details
- 
fromString
Convert a string representation of a key into its object form.- Specified by:
 fromStringin interfaceKeyConverter- Parameters:
 sKey- key as a string- Returns:
 - key in its object form
 
 - 
toString
Convert an object representation of a key into its string form.- Specified by:
 toStringin interfaceKeyConverter- Parameters:
 oKey- key in its original object form- Returns:
 - string representation of a key
 
 - 
findConstructor
Find a key class constructor that accepts a single String argument.- Returns:
 - constructor if it exists, null otherwise
 
 - 
findMethod
Find a static method with a specified name that accepts a single String argument.- Parameters:
 sMethodName- the name of the method- Returns:
 - method if it exists, null otherwise
 
 
 -