universe.server
Class KeyedItem

java.lang.Object
  |
  +--universe.server.KeyedItem
Direct Known Subclasses:
GalaxyType, GameScale, PlayerType, RaceBase

public class KeyedItem
extends java.lang.Object


Field Summary
private  java.lang.String myBackStory
           
private  java.lang.String myDescription
           
private  java.lang.String myKey
           
private static java.util.Hashtable ourKeySpaceTable
           
 
Constructor Summary
KeyedItem()
          no-args constructor as needed for subclasses which implement Serializable
KeyedItem(java.lang.String aKey, java.lang.String keySpaceName)
          This is the designated constructor for objects of this class.
 
Method Summary
static java.lang.Object FindByDescriptionAndSpace(java.lang.String aDescription, java.lang.String keySpaceName)
          This class method returns an instance in the given keyspace whose description matches the one given.
static java.lang.Object FindByKeyAndSpace(java.lang.String aKey, java.lang.String keySpaceName)
          This class method returns the instance which is stored under the given key in the key space with the given name, or null if no such object exists.
 java.lang.String getBackStory()
          This method returns the localized back story associated with the receiving instance.
 java.lang.String getDescription()
          This method returns the localized description associated with the receiving instance.
 java.lang.String getKey()
          This method returns the key word associated with the receiving instance.
 int hashCode()
          This method returns a hash code value which can be used by Hashtable objects.
 void performLocalization()
          Since we don't wnat these objects to bother initializing their localized string attributes until (and if) neccessary, this method takes care of doing that when it is required.
 void setBackStory(java.lang.String newValue)
          This method sets the localized back story associated with the receiving instance.
 void setDescription(java.lang.String newValue)
          This method sets the localized description associated with the receiving instance.
 java.lang.String toString()
          This method simply returns the description of of the receiving instance suitable for display in the user interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ourKeySpaceTable

private static java.util.Hashtable ourKeySpaceTable

myKey

private java.lang.String myKey

myDescription

private java.lang.String myDescription

myBackStory

private java.lang.String myBackStory
Constructor Detail

KeyedItem

public KeyedItem()
no-args constructor as needed for subclasses which implement Serializable


KeyedItem

public KeyedItem(java.lang.String aKey,
                 java.lang.String keySpaceName)
This is the designated constructor for objects of this class.

Parameters:
aKey - The invariant keyword unique in the new instance's key space
keySpaceName - The name of the key space where the key is unique.
See Also:
getKey, FindByKeyAndSpace
Method Detail

FindByKeyAndSpace

public static java.lang.Object FindByKeyAndSpace(java.lang.String aKey,
                                                 java.lang.String keySpaceName)
This class method returns the instance which is stored under the given key in the key space with the given name, or null if no such object exists.

Parameters:
aKey - The key uniquely identifying the desired object in the given key space

FindByDescriptionAndSpace

public static java.lang.Object FindByDescriptionAndSpace(java.lang.String aDescription,
                                                         java.lang.String keySpaceName)
This class method returns an instance in the given keyspace whose description matches the one given. This method is much less efficient than searching by key but can be useful for dealing with API's which when given objects simply extract their UI strings using toString(). JComboBox is a good example of this. If multiple objects in the key space have the same description it is indeterminate which one will be returned.

Parameters:
aDescription - The description of the desired object

getKey

public java.lang.String getKey()
This method returns the key word associated with the receiving instance.


getDescription

public java.lang.String getDescription()
This method returns the localized description associated with the receiving instance.


setDescription

public void setDescription(java.lang.String newValue)
This method sets the localized description associated with the receiving instance. This method is not normally called directly, but instead relies on performLocalization.

Parameters:
newValue - The new description string value.
See Also:
performLocalization, getDescription

getBackStory

public java.lang.String getBackStory()
This method returns the localized back story associated with the receiving instance.


setBackStory

public void setBackStory(java.lang.String newValue)
This method sets the localized back story associated with the receiving instance. This method is not normally called directly, but instead relies on performLocalization.

Parameters:
newValue - The new back story string value.
See Also:
performLocalization., getBackStory

performLocalization

public void performLocalization()
Since we don't wnat these objects to bother initializing their localized string attributes until (and if) neccessary, this method takes care of doing that when it is required. The implementation in this class does nothing. Subclasses should override this to determine and initialize the description and back story instance variables.


toString

public java.lang.String toString()
This method simply returns the description of of the receiving instance suitable for display in the user interface.

Overrides:
toString in class java.lang.Object
See Also:
getDescription

hashCode

public int hashCode()
This method returns a hash code value which can be used by Hashtable objects.

Overrides:
hashCode in class java.lang.Object


Copyright © 2001 Universe Dev Team All Rights Reserved.