net.agmodel.utility
Class MultilingualString

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--net.agmodel.utility.MultilingualString
All Implemented Interfaces:
Cloneable, Comparable, Map, Serializable

public class MultilingualString
extends Hashtable
implements Serializable, Comparable, Cloneable

Stores different language representations of a string of text identified by id. id can be in any language. It serves as a default representation of the string if the requested language is not available, and is used for hashcodes and the like. id should be invariant, so it should not routinely be used for a particular language ie Use crop=new MultilingualString("PEACH") and crop.put("en","Peach") so that if you decide to change "Peach" to "peach", you don't have to discard all the other language versions.

See Also:
Serialized Form

Constructor Summary
MultilingualString(String anID)
           
 
Method Summary
 Object clone()
           
 int compareTo(Object a)
           
 boolean equals(Object obj)
          Multilingual strings are assumed equal if the DEFAULT_LANGUAGE strings match.
 String get()
           
 String get(String language)
           
 int hashcode()
          This is necessary (as far as I see it) because the hashcode of two equal objects must be equal
 void put(String language, String text)
           
 String toString()
           
 
Methods inherited from class java.util.Hashtable
clear, contains, containsKey, containsValue, elements, entrySet, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultilingualString

public MultilingualString(String anID)
Method Detail

put

public void put(String language,
                String text)

get

public String get()

get

public String get(String language)

toString

public String toString()
Overrides:
toString in class Hashtable

equals

public boolean equals(Object obj)
Multilingual strings are assumed equal if the DEFAULT_LANGUAGE strings match.

Specified by:
equals in interface Map
Overrides:
equals in class Hashtable

compareTo

public int compareTo(Object a)
Specified by:
compareTo in interface Comparable

hashcode

public int hashcode()
This is necessary (as far as I see it) because the hashcode of two equal objects must be equal


clone

public Object clone()
Overrides:
clone in class Hashtable