|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.pelzer.util.l10n.Localizable<E>
public class Localizable<E>
This class wraps multiple versions of an object (E) based on a localizer, and then has some defaulting logic for grabbing a single entry back out.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
Localizable()
|
|
Localizable(E defaultValue,
Locale locale)
Instantiates, and then calls #setDefault(E, Locale) |
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<Locale,E>> |
entrySet()
|
E |
exactGet(Locale locale)
|
E |
get(Locale... preferredLocales)
|
E |
get(Object key)
|
Locale[] |
getAllLocales()
|
E |
getDefault()
|
Locale |
getDefaultLocale()
|
Map<Locale,E> |
getWrappedMap()
Since this class is actually just wrapping an underlying hashmap, for hibernate support we need to have direct access to this value... |
boolean |
hasExactMatch(Locale locale)
|
boolean |
isEmpty()
Localizable can never be empty. |
Set<Locale> |
keySet()
|
E |
put(Locale locale,
E value)
|
void |
putAll(Map<? extends Locale,? extends E> t)
|
E |
remove(Object key)
|
E |
set(E value,
Locale locale)
Adds or overrides a value to the internal hash. |
void |
setDefault(E value,
Locale locale)
Overrides the default locale value. |
void |
setWrappedMap(Map<Locale,E> values)
|
int |
size()
|
Collection<E> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public Localizable()
public Localizable(E defaultValue,
Locale locale)
#setDefault(E, Locale)
defaultValue - can be null, and subsequent calls to getDefault will return null
NullPointerException - if locale is null.| Method Detail |
|---|
public Locale[] getAllLocales()
exactGet(Locale) to return absolute values
public E set(E value,
Locale locale)
value - If set to null, removes the value from the internal hash (the local will no longer
show up in getAllLocales()
NullPointerException - if locale is null.
public void setDefault(E value,
Locale locale)
value - can be null, and subsequent calls to getDefault will return null
NullPointerException - if locale is null.public E getDefault()
#setDefault(String, Localizer)public E exactGet(Locale locale)
public boolean hasExactMatch(Locale locale)
public E get(Locale... preferredLocales)
Locale.NONE, then
getDefault() will be returned. A null is possible if no matches are found, and
Locale.NONE is not one of the preferred locales.public Locale getDefaultLocale()
#setDefault(String, Localizer)public Map<Locale,E> getWrappedMap()
setWrappedMap(Map)public void setWrappedMap(Map<Locale,E> values)
getWrappedMap()public void clear()
clear in interface Map<Locale,E>public boolean containsKey(Object key)
containsKey in interface Map<Locale,E>public boolean containsValue(Object value)
containsValue in interface Map<Locale,E>public Set<Map.Entry<Locale,E>> entrySet()
entrySet in interface Map<Locale,E>public E get(Object key)
get in interface Map<Locale,E>public boolean isEmpty()
isEmpty in interface Map<Locale,E>public Set<Locale> keySet()
keySet in interface Map<Locale,E>
public E put(Locale locale,
E value)
put in interface Map<Locale,E>public void putAll(Map<? extends Locale,? extends E> t)
putAll in interface Map<Locale,E>public E remove(Object key)
remove in interface Map<Locale,E>public int size()
size in interface Map<Locale,E>public Collection<E> values()
values in interface Map<Locale,E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||