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, setSourceNames
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createBaseTranslator, createDummyTranslator, createTrimTranslator, getSource, getSourceNames, getTranslatedNamesAsArray, setSourceNames, setSourceNames, setSourceNames
cloneQuietly, cloneQuietly
protected 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
Cloneable
clone
in interface NamesTranslator
clone
in class AbstractNamesTranslator
java.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 AbstractNamesTranslator
public java.util.List<java.lang.String> getTranslatedNames()
NamesTranslator
getTranslatedNames
in interface NamesTranslator
public java.lang.String getTranslation(java.lang.String sourceName)
NamesTranslator
getTranslation
in interface NamesTranslator
public java.lang.String getSource(java.lang.String translatedName)
NamesTranslator
getSource
in interface NamesTranslator
public java.lang.String getTranslation(int index)
NamesTranslator
getTranslation
in interface NamesTranslator
public int addSource(java.lang.String sourceName)
addSource
in interface NamesTranslator
public int setTranslation(java.lang.String sourceName, java.lang.String translatedName)
NamesTranslator
setTranslation
in interface NamesTranslator
public int setTranslation(int sourcePosition, java.lang.String translatedName)
setTranslation
in interface NamesTranslator
public java.lang.String getSuggestion(java.lang.String name)
NamesTranslator
getSuggestion
in interface NamesTranslator
public boolean isValid(java.lang.String name)
NamesTranslator
isValid
in interface NamesTranslator
isValid
in class AbstractNamesTranslator
public static void registerPersistence()
public void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
saveToState
in class AbstractNamesTranslator
PersistenceException
public void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
loadFromState
in class AbstractNamesTranslator
PersistenceException
public void rebuild()
rebuild
in interface NamesTranslator
public void updateSourceNames(java.lang.String[] names)
updateSourceNames
in interface NamesTranslator
public void updateSourceNames(java.lang.Iterable<java.lang.String> names)
updateSourceNames
in interface NamesTranslator
public void updateSourceNames(java.lang.Iterable objs, java.util.function.Function<java.lang.Object,java.lang.String> name_getter)
updateSourceNames
in interface NamesTranslator
public java.util.List<java.lang.String> getAllTranslations(java.lang.String sourceName)
getAllTranslations
in interface NamesTranslator
public void clear()
clear
in interface NamesTranslator
public boolean hasDuplicateSources()
hasDuplicateSources
in interface NamesTranslator