net.agmodel.utility
Class MultilingualString

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended bynet.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, remove, size, values
 
Methods inherited from class java.lang.Object
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()

equals

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

Specified by:
equals in interface Map

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()


Copyright (C) NARC 2001 All Rights Reserved.