Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


com.tangosol.coherence.rest
Class DefaultKeyConverter

java.lang.Object
  extended by com.tangosol.coherence.rest.DefaultKeyConverter

All Implemented Interfaces:
KeyConverter

public class DefaultKeyConverter
extends java.lang.Object
implements KeyConverter

Default implementation of KeyConverter for a given key class.

This KeyConverter implementation uses the following rules to perform key conversion:

Author:
as 2011.06.08

Field Summary
protected static java.text.DateFormat DATE_FORMAT
          DateFormat instance that will be used to convert Date keys.
protected  java.lang.Class m_clzKey
          Key class.
protected  java.lang.reflect.Constructor m_ctorFromString
          Constructor to use for conversion from string.
protected  java.lang.reflect.Method m_methFromString
          Static method to use for conversion from string.
protected static java.lang.String[] METHODS
          Method names that should be tried in order when looking for a method that can be used for conversion from string.

 

Constructor Summary
DefaultKeyConverter(java.lang.Class clzKey)
          Construct a DefaultKeyConverter instance.

 

Method Summary
protected  java.lang.reflect.Constructor findConstructor()
          Find a key class constructor that accepts a single String argument.
protected  java.lang.reflect.Method findMethod(java.lang.String sMethodName)
          Find a static method with a specified name that accepts a single String argument.
 java.lang.Object fromString(java.lang.String sKey)
          Convert a string representation of a key into its object form.
 java.lang.String toString(java.lang.Object oKey)
          Convert an object representation of a key into its string form.

 

Field Detail

m_clzKey

protected final java.lang.Class m_clzKey
Key class.

m_ctorFromString

protected final java.lang.reflect.Constructor m_ctorFromString
Constructor to use for conversion from string.

m_methFromString

protected final java.lang.reflect.Method m_methFromString
Static method to use for conversion from string.

METHODS

protected static final java.lang.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

protected static final java.text.DateFormat DATE_FORMAT
DateFormat instance that will be used to convert Date keys.

Constructor Detail

DefaultKeyConverter

public DefaultKeyConverter(java.lang.Class clzKey)
Construct a DefaultKeyConverter instance.
Parameters:
clzKey - key class

Method Detail

fromString

public java.lang.Object fromString(java.lang.String sKey)
Convert a string representation of a key into its object form.
Specified by:
fromString in interface KeyConverter
Parameters:
sKey - key as a string
Returns:
key in its object form

toString

public java.lang.String toString(java.lang.Object oKey)
Convert an object representation of a key into its string form.
Specified by:
toString in interface KeyConverter
Parameters:
oKey - key in its original object form
Returns:
string representation of a key

findConstructor

protected java.lang.reflect.Constructor findConstructor()
Find a key class constructor that accepts a single String argument.
Returns:
constructor if it exists, null otherwise

findMethod

protected java.lang.reflect.Method findMethod(java.lang.String sMethodName)
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

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.1.0

E22843-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.