public class LocalizedEntryListFactory<C> extends Object implements Serializable, Cloneable
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.String, java.lang.Object>, java.lang.Class<?>, java.util.Comparator<? super java.lang.Object>).
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 and Description |
|---|
LocalizedEntryListFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected List<Serializable> |
add(Locale locale,
Object entry)
Add entry to 'localized'
|
Map.Entry<Serializable,Serializable> |
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<Map.Entry<C,String>> |
get(Locale locale)
Defaulting version of
get(Locale, Cloud). |
List<Map.Entry<C,String>> |
get(Locale locale,
Cloud cloud)
Returns a Collection of Map.Entries for the given Locale.
|
List<Map.Entry<C,String>> |
get(Locale locale,
Cloud c,
Node node,
Field field) |
protected Cloud |
getCloud(Locale locale) |
protected ChainedIterator |
getIterator(Locale useLocale) |
List<C> |
getKeys(Locale locale,
Cloud c,
Node node,
Field field) |
protected List<Map.Entry<C,? extends CharSequence>> |
getLazy(Locale locale,
Cloud c,
Node node,
Field field) |
List<Query> |
getQueries(Cloud cloud,
Node node,
Field field)
Return the
Query's that define this enumeration factory. |
boolean |
isEmpty() |
int |
size() |
int |
size(Cloud cloud)
The size of the collections returned by
get(java.util.Locale) |
String |
toString() |
Element |
toXml() |
public boolean isEmpty()
public Map.Entry<Serializable,Serializable> add(Locale locale, Serializable key, Serializable value)
protected List<Serializable> 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 usedpublic void addBundle(String baseName, ClassLoader classLoader, Class constantsProvider, Class wrapper, Comparator comparator)
public List<Map.Entry<C,String>> get(Locale locale)
get(Locale, Cloud). Using default anonymous cloud.public List<Map.Entry<C,String>> get(Locale locale, Cloud c, Node node, Field field)
protected ChainedIterator getIterator(Locale useLocale)
public List<Query> getQueries(Cloud cloud, Node node, Field field) throws SearchQueryException
Query's that define this enumeration factory.IllegalStateException - If this factory is not only defined by queries.SearchQueryExceptionprotected List<Map.Entry<C,? extends CharSequence>> getLazy(Locale locale, Cloud c, Node node, Field field)
public List<Map.Entry<C,String>> 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, Cloud cloud)
public void clear()
public void fillFromXml(Element enumerationElement, Class wrapperDefault)
public Element toXml()
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}