|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.LocalizedEntryListFactory
These factories can produce Collections based on a Locale (The get(java.util.Locale) method is
essential). The other methods besides get are methods to define these lists. There are two ways
to add entries to the produced collections. The first one is to explicitely add them, using the
add(java.util.Locale, java.io.Serializable, java.io.Serializable) method. This gives precise control, and the collections can have different orders
for different languages. The size of the collections are always the same, so if for a certain
locale less entries are added, these are completed with the unused keys. If for a certain locale
no entries are added, it will behave itself like as the default locale of LocalizedString.getDefault().
It is also possible to add entire 'bundles'. For this use addBundle(java.lang.String, java.lang.ClassLoader, java.lang.Class, java.lang.Class, java.util.Comparator). When a Collection instance
for a certain Locale is requested these informations are used to call SortedBundle.getResource(java.lang.String, java.util.Locale, java.lang.ClassLoader, java.util.Map, java.lang.Class, java.util.Comparator).
It is possible to mix both methods, so having an enumeration partially defined by a bundle,
partially by explicit values, though this is not recommended.
| Constructor Summary | |
LocalizedEntryListFactory()
|
|
| Method Summary | |
protected List |
add(Locale locale,
Object entry)
Add entry to 'localized' |
Map.Entry |
add(Locale locale,
Serializable key,
Serializable value)
Adds a value for a certain key and Locale |
void |
addBundle(String baseName,
ClassLoader classLoader,
Class constantsProvider,
Class wrapper,
Comparator comparator)
Adds a bundle, to the (current) end of all maintained collections. |
void |
addQuery(Locale locale,
Document queryElement)
|
Object |
castKey(Object key)
|
Object |
castKey(Object key,
Cloud cloud)
Since keys may be somehow wrapped, you can also 'unwrap' by this. |
void |
clear()
Clears all added keys, bundles and queries. |
Object |
clone()
|
void |
fillFromXml(Element enumerationElement,
Class wrapperDefault)
Given a certain DOM parent element, it configures this LocalizedEntryListFactory with sub tags of type 'entry' and 'query' |
List |
get(Locale locale)
Defaulting version of get(Locale, Cloud). |
List |
get(Locale locale,
Cloud cloud)
Returns a Collection of Map.Entries for the given Locale. |
protected Cloud |
getCloud(Locale locale)
|
boolean |
isEmpty()
|
static void |
main(String[] argv)
For testing only. |
int |
size()
|
int |
size(Cloud cloud)
The size of the collections returned by get(java.util.Locale) |
String |
toString()
|
Element |
toXml()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LocalizedEntryListFactory()
| Method Detail |
public boolean isEmpty()
public Map.Entry add(Locale locale,
Serializable key,
Serializable value)
protected List add(Locale locale,
Object entry)
entry - the object, which has not Locale support of itself (Entry, DocumentSerializable)locale - Can be null too, in which case the default locale is used
public void addBundle(String baseName,
ClassLoader classLoader,
Class constantsProvider,
Class wrapper,
Comparator comparator)
public void addQuery(Locale locale,
Document queryElement)
public List get(Locale locale)
get(Locale, Cloud). Using default anonymous cloud.
protected Cloud getCloud(Locale locale)
public List get(Locale locale,
Cloud cloud)
locale - The locale of null for the default locale.cloud - The cloud to use. Can be null if no queries added (see addQuery(java.util.Locale, org.w3c.dom.Document)).
If Locale is null, but cloud isn't, the locale of the cloud is used.public int size(Cloud cloud)
get(java.util.Locale)
public int size()
public Object castKey(Object key)
public Object castKey(Object key,
Cloud cloud)
public Object clone()
public void clear()
public void fillFromXml(Element enumerationElement,
Class wrapperDefault)
public Element toXml()
public String toString()
public static void main(String[] argv)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||