| |
|
| java.lang.Object org.apache.torque.om.ObjectKey org.apache.torque.om.ComboKey
ComboKey | public class ComboKey extends ObjectKey (Code) | | This class can be used as an ObjectKey to uniquely identify an
object within an application where the key consists of multiple
entities (such a String[] representing a multi-column primary key).
author: John McNally author: Daniel Rall author: J. Russell Smyth version: $Id: ComboKey.java 473821 2006-11-11 22:37:25Z tv $ |
Field Summary | |
final public static char | SEPARATOR The single character used to separate key values in a string. | final public static String | SEPARATOR_STRING The single character used to separate key values in a string. |
Constructor Summary | |
public | ComboKey() | public | ComboKey(SimpleKey[] keys) Creates a ComboKey whose internal representation is an
array of SimpleKeys. | public | ComboKey(String keys) Sets the internal representation to a String array. |
Method Summary | |
public void | appendTo(StringBuffer sb) | public boolean | equals(Object keyObj) This method will return true if the conditions for a looseEquals
are met and in addition no parts of the keys are null. | public Object | getValue() Get the underlying object. | public int | hashCode() if the underlying key array is not null and the first element is
not null this method returns the hashcode of the first element
in the key. | public boolean | looseEquals(Object keyObj) keyObj is equal to this ComboKey if keyObj is a ComboKey, String,
ObjectKey[], or String[] that contains the same information this key
contains. | public void | setValue(SimpleKey[] keys) Sets the internal representation using a SimpleKey array. | public void | setValue(String keys) Sets the internal representation using a String of the
form produced by the toString method. | public void | setValue(ComboKey keys) Sets the internal representation using a ComboKey. | public String | toString() A String that may consist of one section or multiple sections
separated by a colon. |
SEPARATOR | final public static char SEPARATOR(Code) | | The single character used to separate key values in a string.
|
SEPARATOR_STRING | final public static String SEPARATOR_STRING(Code) | | The single character used to separate key values in a string.
|
ComboKey | public ComboKey()(Code) | | Creates an ComboKey whose internal representation will be
set later, through a set method
|
ComboKey | public ComboKey(SimpleKey[] keys)(Code) | | Creates a ComboKey whose internal representation is an
array of SimpleKeys.
Parameters: keys - the key values |
ComboKey | public ComboKey(String keys)(Code) | | Sets the internal representation to a String array.
Parameters: keys - the key values See Also: ComboKey.toString() |
equals | public boolean equals(Object keyObj)(Code) | | This method will return true if the conditions for a looseEquals
are met and in addition no parts of the keys are null.
Parameters: keyObj - the comparison value whether the two objects are equal |
getValue | public Object getValue()(Code) | | Get the underlying object.
the underlying object |
hashCode | public int hashCode()(Code) | | if the underlying key array is not null and the first element is
not null this method returns the hashcode of the first element
in the key. Otherwise calls ObjectKey.hashCode()
an int value |
looseEquals | public boolean looseEquals(Object keyObj)(Code) | | keyObj is equal to this ComboKey if keyObj is a ComboKey, String,
ObjectKey[], or String[] that contains the same information this key
contains.
For example A String[] might be equal to this key, if this key was
instantiated with a String[] and the arrays contain equal Strings.
Another example, would be if keyObj is an ComboKey that was
instantiated with a ObjectKey[] and this ComboKey was instantiated with
a String[], but the ObjectKeys in the ObjectKey[] were instantiated
with Strings that equal the Strings in this KeyObject's String[]
This method is not as strict as the equals method which does not
allow any null keys parts, while the internal key may not be null
portions may be, and the two object will be considered equal if
their null portions match.
Parameters: keyObj - the comparison value whether the two objects are equal |
setValue | public void setValue(SimpleKey[] keys)(Code) | | Sets the internal representation using a SimpleKey array.
Parameters: keys - the key values |
setValue | public void setValue(String keys)(Code) | | Sets the internal representation using a String of the
form produced by the toString method.
Parameters: keys - the key values |
setValue | public void setValue(ComboKey keys)(Code) | | Sets the internal representation using a ComboKey.
Parameters: keys - the key values |
toString | public String toString()(Code) | | A String that may consist of one section or multiple sections
separated by a colon.
Each Key is represented by [type N|S|D][value][:] .
Example:
the ComboKey(StringKey("key1"), NumberKey(2)) is represented as
Skey1:N2:
a String representation |
|
|
|