org.apache.torque.om
Class StringKey

java.lang.Object
  extended by org.apache.torque.om.ObjectKey
      extended by org.apache.torque.om.SimpleKey
          extended by org.apache.torque.om.StringKey
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class StringKey
extends SimpleKey

This class can be used as an ObjectKey to uniquely identify an object within an application where the id consists of a single entity such a GUID or the value of a db row's primary key.

Version:
$Id: StringKey.java 473821 2006-11-11 22:37:25Z tv $
Author:
John McNally
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.torque.om.ObjectKey
key
 
Constructor Summary
StringKey()
          Creates an SimpleKey whose internal representation will be set later, through a set method
StringKey(java.lang.String key)
          Creates a StringKey whose internal representation is a String
StringKey(StringKey key)
          Creates a StringKey that is equivalent to key.
 
Method Summary
 boolean equals(java.lang.Object keyObj)
          keyObj is equal to this StringKey if keyObj is a StringKey or String that contains the same information this key contains.
 java.lang.String getString()
          Access the underlying String object.
 void setValue(java.lang.String key)
          Sets the internal representation to a String
 void setValue(StringKey key)
          Sets the internal representation to the same object used by key.
 java.lang.String toString()
          get a String representation
 
Methods inherited from class org.apache.torque.om.SimpleKey
keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor
 
Methods inherited from class org.apache.torque.om.ObjectKey
appendTo, compareTo, getValue, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringKey

public StringKey()
Creates an SimpleKey whose internal representation will be set later, through a set method


StringKey

public StringKey(java.lang.String key)
Creates a StringKey whose internal representation is a String

Parameters:
key - the key value

StringKey

public StringKey(StringKey key)
Creates a StringKey that is equivalent to key.

Parameters:
key - the key value
Method Detail

setValue

public void setValue(java.lang.String key)
Sets the internal representation to a String

Specified by:
setValue in class ObjectKey
Parameters:
key - the key value

setValue

public void setValue(StringKey key)
Sets the internal representation to the same object used by key.

Parameters:
key - the key value

getString

public java.lang.String getString()
Access the underlying String object.

Returns:
a String value

equals

public boolean equals(java.lang.Object keyObj)
keyObj is equal to this StringKey if keyObj is a StringKey or String that contains the same information this key contains. Two ObjectKeys that both contain null values are not considered equal.

Overrides:
equals in class java.lang.Object
Parameters:
keyObj - the comparison value
Returns:
whether the two objects are equal

toString

public java.lang.String toString()
get a String representation

Overrides:
toString in class java.lang.Object
Returns:
a String representation of an empty String if the value is null


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.