org.dasein.util
Class Translator<T>

java.lang.Object
  extended by org.dasein.util.PseudoMap<Locale,Translation<T>>
      extended by org.dasein.util.Translator<T>
All Implemented Interfaces:
Serializable, Map<Locale,Translation<T>>, DelegatedComparable

public class Translator<T>
extends PseudoMap<Locale,Translation<T>>
implements DelegatedComparable, Serializable


Last modified: $Date

Version:
$Revision: 1.3 $
Author:
George Reese (http://george.reese.name)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
Translator(Locale loc, T msg)
           
Translator(Map<Locale,T> trans)
           
 
Method Summary
 boolean containsKey(Object key)
           
 boolean containsValue(Object val)
           
 Translator<T> copy()
           
 Iterator<String> countries(String lang)
           
 Set<Map.Entry<Locale,Translation<T>>> entrySet()
           
 boolean equals(Object ob)
           
 Translation<T> get(Collection<Locale> locales)
           
 Translation<T> get(Object key)
           
 Translation<T> getAnyTranslation()
           
 Translation<T> getBestTranslation(Locale loc)
           
 Translation<T> getBestTranslation(String lang)
           
 Translation<T> getBestTranslation(String lang, String ctry)
           
 Object getDelegate(Locale loc)
           
 Translation<T> getExactTranslation(Locale loc)
           
 Translation<T> getTranslation(Collection<Locale> locales)
           
 Translation<T> getTranslation(Locale loc)
           
 Translation<T> getTranslation(String lang, String ctry)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set<Locale> keySet()
           
 Iterator<String> languages()
           
 Translator<T> newTranslator(Locale loc, T val)
           
 Translator<T> newTranslator(Map<String,Map<String,T>> additional)
           
 Translator<T> newTranslator(Translator<T> t)
           
static Locale parseLocale(String iso)
           
 int size()
           
 Map<Locale,? extends Object> toMap()
           
 String toString()
           
 Collection<Translation<T>> values()
           
 
Methods inherited from class org.dasein.util.PseudoMap
clear, put, putAll, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Translator

public Translator(Map<Locale,T> trans)

Translator

public Translator(Locale loc,
                  T msg)
Method Detail

parseLocale

public static Locale parseLocale(String iso)

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<Locale,Translation<T>>

containsValue

public boolean containsValue(Object val)
Specified by:
containsValue in interface Map<Locale,Translation<T>>

copy

public Translator<T> copy()

entrySet

public Set<Map.Entry<Locale,Translation<T>>> entrySet()
Specified by:
entrySet in interface Map<Locale,Translation<T>>

equals

public boolean equals(Object ob)
Specified by:
equals in interface Map<Locale,Translation<T>>
Overrides:
equals in class Object

get

public Translation<T> get(Object key)
Specified by:
get in interface Map<Locale,Translation<T>>

get

public Translation<T> get(Collection<Locale> locales)

getAnyTranslation

public Translation<T> getAnyTranslation()

getBestTranslation

public Translation<T> getBestTranslation(String lang)

getBestTranslation

public Translation<T> getBestTranslation(String lang,
                                         String ctry)

getBestTranslation

public Translation<T> getBestTranslation(Locale loc)

getDelegate

public Object getDelegate(Locale loc)
Specified by:
getDelegate in interface DelegatedComparable

getExactTranslation

public Translation<T> getExactTranslation(Locale loc)

getTranslation

public Translation<T> getTranslation(Locale loc)

getTranslation

public Translation<T> getTranslation(Collection<Locale> locales)

getTranslation

public Translation<T> getTranslation(String lang,
                                     String ctry)

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<Locale,Translation<T>>
Overrides:
hashCode in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Locale,Translation<T>>

keySet

public Set<Locale> keySet()
Specified by:
keySet in interface Map<Locale,Translation<T>>

countries

public Iterator<String> countries(String lang)

languages

public Iterator<String> languages()

newTranslator

public Translator<T> newTranslator(Translator<T> t)

newTranslator

public Translator<T> newTranslator(Locale loc,
                                   T val)

newTranslator

public Translator<T> newTranslator(Map<String,Map<String,T>> additional)

size

public int size()
Specified by:
size in interface Map<Locale,Translation<T>>

toMap

public Map<Locale,? extends Object> toMap()

toString

public String toString()
Overrides:
toString in class Object

values

public Collection<Translation<T>> values()
Specified by:
values in interface Map<Locale,Translation<T>>