public class BaseNamesTranslator extends AbstractNamesTranslator implements NamesTranslator, Persistent
AbstractNamesTranslator.SimpleList, AbstractNamesTranslator.SimpleMap| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_FIELD_NAME |
protected boolean |
hasTranslations |
protected AbstractNamesTranslator.SimpleMap |
source2translation |
protected AbstractNamesTranslator.SimpleList |
translatedNames |
protected AbstractNamesTranslator.SimpleMap |
translation2source |
sourceNames| Constructor and Description |
|---|
BaseNamesTranslator() |
| Modifier and Type | Method and Description |
|---|---|
int |
addSource(java.lang.String sourceName) |
protected void |
build() |
void |
clear() |
NamesTranslator |
clone()
Creates a copy of the object.
|
java.util.List<java.lang.String> |
getAllTranslations(java.lang.String sourceName) |
java.lang.String |
getSource(java.lang.String translatedName)
Returns the source name corresponding to the translation indicated
in the "translationName" parameter.
|
java.lang.String |
getSuggestion(java.lang.String name)
Check if the name passed as a parameter collides with
any existing translation.
|
java.util.List<java.lang.String> |
getTranslatedNames()
Return the list of translated names.
|
java.lang.String |
getTranslation(int index)
Returns the translation corresponding to the source name indicated
in the "index" parameter.
|
java.lang.String |
getTranslation(java.lang.String sourceName)
Returns the translation corresponding to the source name indicated
in the "sourceName" parameter.
|
boolean |
hasDuplicateSources() |
boolean |
isValid(java.lang.String name)
Returns true if the name passed as a parameter does not collide
with any of the existing translations.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
rebuild() |
static void |
registerPersistence() |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
int |
setTranslation(int sourcePosition,
java.lang.String translatedName) |
int |
setTranslation(java.lang.String sourceName,
java.lang.String translatedName)
Assign the translation "translationName" to the name "sourceName".
|
void |
updateSourceNames(java.lang.Iterable<java.lang.String> names) |
void |
updateSourceNames(java.lang.Iterable objs,
java.util.function.Function<java.lang.Object,java.lang.String> name_getter) |
void |
updateSourceNames(java.lang.String[] names) |
getSource, getSourceNames, getTranslatedNamesAsArray, setSourceNames, setSourceNames, setSourceNamesequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateBaseTranslator, createDummyTranslator, createTrimTranslator, getSource, getSourceNames, getTranslatedNamesAsArray, setSourceNames, setSourceNames, setSourceNamescloneQuietly, cloneQuietlyprotected AbstractNamesTranslator.SimpleMap source2translation
protected AbstractNamesTranslator.SimpleMap translation2source
protected boolean hasTranslations
public static final java.lang.String DEFAULT_FIELD_NAME
protected AbstractNamesTranslator.SimpleList translatedNames
public NamesTranslator clone() throws java.lang.CloneNotSupportedException
Cloneableclone in interface NamesTranslatorclone in class AbstractNamesTranslatorjava.lang.CloneNotSupportedException - if the instance of the object cannot
be cloned. As this is extending Cloneable so its sure
it implements it, so this exception may be used for problems on specific
object instances.Object#clone()}.protected void build()
build in class AbstractNamesTranslatorpublic java.util.List<java.lang.String> getTranslatedNames()
NamesTranslatorgetTranslatedNames in interface NamesTranslatorpublic java.lang.String getTranslation(java.lang.String sourceName)
NamesTranslatorgetTranslation in interface NamesTranslatorpublic java.lang.String getSource(java.lang.String translatedName)
NamesTranslatorgetSource in interface NamesTranslatorpublic java.lang.String getTranslation(int index)
NamesTranslatorgetTranslation in interface NamesTranslatorpublic int addSource(java.lang.String sourceName)
addSource in interface NamesTranslatorpublic int setTranslation(java.lang.String sourceName,
java.lang.String translatedName)
NamesTranslatorsetTranslation in interface NamesTranslatorpublic int setTranslation(int sourcePosition,
java.lang.String translatedName)
setTranslation in interface NamesTranslatorpublic java.lang.String getSuggestion(java.lang.String name)
NamesTranslatorgetSuggestion in interface NamesTranslatorpublic boolean isValid(java.lang.String name)
NamesTranslatorisValid in interface NamesTranslatorisValid in class AbstractNamesTranslatorpublic static void registerPersistence()
public void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentsaveToState in class AbstractNamesTranslatorPersistenceExceptionpublic void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentloadFromState in class AbstractNamesTranslatorPersistenceExceptionpublic void rebuild()
rebuild in interface NamesTranslatorpublic void updateSourceNames(java.lang.String[] names)
updateSourceNames in interface NamesTranslatorpublic void updateSourceNames(java.lang.Iterable<java.lang.String> names)
updateSourceNames in interface NamesTranslatorpublic void updateSourceNames(java.lang.Iterable objs,
java.util.function.Function<java.lang.Object,java.lang.String> name_getter)
updateSourceNames in interface NamesTranslatorpublic java.util.List<java.lang.String> getAllTranslations(java.lang.String sourceName)
getAllTranslations in interface NamesTranslatorpublic void clear()
clear in interface NamesTranslatorpublic boolean hasDuplicateSources()
hasDuplicateSources in interface NamesTranslator