public class EntityCatalog<E extends Entity> extends Object implements Translet.Parseable<E>
Entity
must be contained in one such EntityCatalog.
The name and documentation of the catalog itself is also multi lingual.
This class also defines a pseudo language for symbolic, non-national representations.
Modifier and Type | Field and Description |
---|---|
protected @Opt String |
defaultLang
The default language to present its entities and the catalogue itself, if any.
|
protected Catalog<E> |
entityNames
The multi-lingual catalog of entities contained.
|
static MuLi |
noNames
Constant for constructing an entity without any name.
|
protected MuLi |
ownNames
The name of this catalog, which in most cases is different in different
human languages, like .
|
static String |
symbolic
Language code of a pseudo language, used to index symbolic, non-national
representations.
|
static String |
unicode
Language code for the unicode symbols as a translation target (=pseudo language).
|
Constructor and Description |
---|
EntityCatalog(Class<E> itemClass,
String defaultLang,
MuLi ownNames)
Constructor configuring all fields ocmpletely.
|
EntityCatalog(Class<E> itemClass,
String defaultLang,
String defaultLangOwnName)
Constructor with slightly restricted values.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntityName(E entity,
String lang,
String name)
Put one additional name for an entity, beyond those defined at creation.
|
void |
addEntityNames(E entity,
MuLi humanNames)
Put additional names for an entity, beyond those defined at creation.
|
static boolean |
doesNotOverrideSymbolic(MuLi muli)
Checks whether the symbolic language is used in the MuLi argument.
|
void |
dump(PrintStream ps)
Debugging method to print its contents.
|
String |
getDefaultLanguage() |
Set<E> |
getEntities()
Returns all entities contained.
|
E |
getEntity(String name)
Returns the
Entity with the given name in the catalog's default language,
or "null" if no such present. |
E |
getEntity(String lang,
String name)
Returns the
Entity with the given name in the in given language,
or "null" if no such present. |
@Opt String |
getName()
Returns the name of the catalog, in the default language or "null" if no such is present.
|
@Opt String |
getName(String lang)
Returns the name of the catalog, in the given language, or "null" if no such is present.
|
MuLi |
getNames(E entity)
Returns all names of the given
Entity . |
Translet.Parser<E> |
getParser()
Get a parser which accepts the names of the entities in the default language.
|
Translet.Parser<E> |
getParser(String lang)
Get a parser which accepts the names of the entities in the given
language and returns the possibly found Entity as its value.
|
E |
getSymbolic(String name)
Returns the
Entity with the given name in the symboolic language,
or "null" if no such present. |
<F extends E> |
lend(F ent)
Duplicate the reference to an entity in a different catalog by this catalog.
|
void |
lendFrom(EntityCatalog<? extends E> origCat,
String lang,
String name)
Duplicate the reference to an entity in a different catalog by this catalog.
|
void |
setDefaultLanguage(String l)
Changes default language dynamically.
|
public static final String symbolic
public static final String unicode
public static final MuLi noNames
protected MuLi ownNames
protected Catalog<E extends Entity> entityNames
public EntityCatalog(Class<E> itemClass, String defaultLang, MuLi ownNames)
itemClass
- the class of all entities contained in the new catalog.defaultLang
- the language code used as default for all entities
contained herein, and for name and doc of the catalog itself.ownNames
- the names of the catalog, possibly in more than one language.public EntityCatalog(Class<E> itemClass, String defaultLang, String defaultLangOwnName)
itemClass
- the class of all entities contained in the new catalog.defaultLang
- the language code used as default for all entities
contained herein, and for name and doc of the catalog itself.defaultLangOwnName
- only one name for the catalog itself, in its default language.public static boolean doesNotOverrideSymbolic(MuLi muli)
public void dump(PrintStream ps)
public String getDefaultLanguage()
public void setDefaultLanguage(String l)
@Opt public @Opt String getName()
@Opt public @Opt String getName(String lang)
@Opt public E getEntity(String lang, String name)
Entity
with the given name in the in given language,
or "null" if no such present.@Opt public E getEntity(String name)
Entity
with the given name in the catalog's default language,
or "null" if no such present.@Opt public E getSymbolic(String name)
Entity
with the given name in the symboolic language,
or "null" if no such present.public void addEntityNames(E entity, MuLi humanNames)
public void addEntityName(E entity, String lang, String name)
@Opt public Translet.Parser<E> getParser(String lang)
Translet._CAT
, see there for
the behaviour in case of failure.getParser
in interface Translet.Parseable<E extends Entity>
@Opt public Translet.Parser<E> getParser()
getParser
in interface Translet.Parseable<E extends Entity>
public void lendFrom(EntityCatalog<? extends E> origCat, String lang, String name)
Ornament_KdF_special
public <F extends E> void lend(F ent)
Ornament_KdF_special