Package overit.geocall.lang
Class CacheTeacher
java.lang.Object
overit.geocall.lang.Teacher
overit.geocall.lang.CacheTeacher
This class implements a
Teacher that does make translations and stores in two separated caches
the translations for the field names and the string values to be more efficient and faster when is requested
a translation that has already been done before-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Dictionaryprotected intprotected Omissionprotected ConcurrentHashMap<String, String> protected Stringprotected ConcurrentHashMap<String, String> Fields inherited from class overit.geocall.lang.Teacher
_duty, AVOID, TRY, TRY_OUTPUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts the source string passed as parameter in the corresponding converted string.convertLabel(String source) Converts the label string passed as parameter in the corresponding converted label.convertName(String name) Converts the field name passed as parameter in the corresponding converted field name.Returns theDictionaryReturns an Iterator over the keys of the field names's cacheprotected static voidvoidregisterOmissions(String lang, String pkg, Long factory) Register the missing translationvoidreset()Resets the Teacher, ie empties the translations cachesReturns an Iterator over the keys of the values's cacheMethods inherited from class overit.geocall.lang.Teacher
adjust, adjustLabel, getDuty, getTeacher, getTeacher, getTeacher, getTeacher, getTeacher, getTeacher, getType4Legacy, isMarked, mark, translate, translateContent, translateContent, translateContent, translateContent, translateContent, translateLabel, translateName, translateName, translateName, translateName
-
Field Details
-
_dictionary
-
_missings
-
_valueTranslations
-
_nameTranslations
-
_maxDim
protected int _maxDim -
_tableSuffix
-
-
Constructor Details
-
CacheTeacher
Creates a new CacheTeacher- Parameters:
td- TheTeacherDutyused to create the Teacher
-
-
Method Details
-
registerOmissions
Register the missing translation- Parameters:
lang- The languagepkg- The applicative packagefactory- The company ID
-
convertName
Converts the field name passed as parameter in the corresponding converted field name. It searches the translation first in the cache, and after that in theDictionary. If there is a translation it returns it (and registers it in the cache), otherwise it returnsnull- Specified by:
convertNamein classTeacher- Parameters:
name- A valued and consistent string, with length greater than 0, that must be converted and corresponds to a field name- Returns:
- The coversion of the field name, or
nullif the translation is missing
-
convert
Converts the source string passed as parameter in the corresponding converted string. It searches the translation first in the cache, and after that in theDictionary. If there is a translation it returns it (and registers it in the cache), otherwise it returnsnull -
convertLabel
Converts the label string passed as parameter in the corresponding converted label. It searches the translation first in the cache, and after that in theDictionary. The @ characters are removed from the strings because they are not considered in dictionaries files; after the translation, if requested, the system tries to reinsert the @ character in the right position.
If there is a translation it returns it (and registers it in the cache), otherwise it returnsnull- Specified by:
convertLabelin classTeacher- Parameters:
source- A valued and consistent string, with length greater than 0, that must be translated and corresponds to a user interface label- Returns:
- The converted label, or
nullif the translation is missing
-
register
-
reset
public void reset()Description copied from class:TeacherResets the Teacher, ie empties the translations caches -
valueKeySetIterator
Returns an Iterator over the keys of the values's cache- Returns:
- An Iterator over the entry's keys of the values's cache
-
nameKeySetIterator
Returns an Iterator over the keys of the field names's cache- Returns:
- An Iterator over the entry's keys of the field names's cache
-
getDictionary
Returns theDictionary- Returns:
- The dictionary used by the teacher
-