| java.lang.Object org.mmbase.util.LocalizedEntryListFactory
LocalizedEntryListFactory | public class LocalizedEntryListFactory implements Serializable,Cloneable(Code) | | These factories can produce Collections based on a Locale (The
LocalizedEntryListFactory.get 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
LocalizedEntryListFactory.add 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
LocalizedEntryListFactory.addBundle . When a Collection instance
for a certain Locale is requested these informations are used to call
SortedBundle.getResource .
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.
author: Michiel Meeuwissen version: $Id: LocalizedEntryListFactory.java,v 1.48 2008/02/03 17:33:57 nklasens Exp $ since: MMBase-1.8 |
Method Summary | |
public Map.Entry<Serializable, Serializable> | add(Locale locale, Serializable key, Serializable value) | protected List<Serializable> | add(Locale locale, Object entry) | public void | addBundle(String baseName, ClassLoader classLoader, Class constantsProvider, Class wrapper, Comparator comparator) Adds a bundle, to the (current) end of all maintained collections. | public void | addQuery(Locale locale, Document queryElement) | public Object | castKey(Object key) | public Object | castKey(Object key, Cloud cloud) Since keys may be somehow wrapped, you can also 'unwrap' by this. | public void | clear() Clears all added keys, bundles and queries. | public Object | clone() | public void | fillFromXml(Element enumerationElement, Class wrapperDefault) | public List<Map.Entry<C, String>> | get(Locale locale) Defaulting version of
LocalizedEntryListFactory.get(Locale,Cloud) . | public List<Map.Entry<C, String>> | get(Locale locale, Cloud cloud) Returns a Collection of Map.Entries for the given Locale. | protected Cloud | getCloud(Locale locale) | public boolean | isEmpty() | public static void | main(String argv) For testing only. | public int | size(Cloud cloud) | public int | size() | public String | toString() | public Element | toXml() |
LocalizedEntryListFactory | public LocalizedEntryListFactory()(Code) | | |
add | protected List<Serializable> add(Locale locale, Object entry)(Code) | | Add entry to 'localized'
Parameters: entry - the object, which has not Locale support of itself (Entry, DocumentSerializable) Parameters: locale - Can be null too, in which case the default locale is used List of currently unused keys for this locale. |
addBundle | public void addBundle(String baseName, ClassLoader classLoader, Class constantsProvider, Class wrapper, Comparator comparator)(Code) | | Adds a bundle, to the (current) end of all maintained collections. Actually, only the
definition of the bundle is added, it is instantiated only later, when requested for a
specific locale.
|
castKey | public Object castKey(Object key, Cloud cloud)(Code) | | Since keys may be somehow wrapped, you can also 'unwrap' by this. If e.g. a constants
provider was used, that values can be indicated by the name of the constants and this method
casts to the value.
|
clear | public void clear()(Code) | | Clears all added keys, bundles and queries.
|
fillFromXml | public void fillFromXml(Element enumerationElement, Class wrapperDefault)(Code) | | Given a certain DOM parent element, it configures this LocalizedEntryListFactory with
sub tags of type 'entry' and 'query'
|
get | public List<Map.Entry<C, String>> get(Locale locale, Cloud cloud)(Code) | | Returns a Collection of Map.Entries for the given Locale. The collection is kind of 'virtual',
it only reflects the underlying memory structures.
This collection does have a well defined iteration order.
Parameters: locale - The locale of null for the default locale. Parameters: cloud - The cloud to use. Can be null if no queries added (see LocalizedEntryListFactory.addQuery).If Locale is null , but cloud isn't, the locale of the cloud is used. |
isEmpty | public boolean isEmpty()(Code) | | |
main | public static void main(String argv)(Code) | | For testing only.
|
|
|