|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.web4j.ui.translate.Translation.LookupResult
public static final class Translation.LookupResult
The result of Translation.lookUp(String, Locale, Map)
.
Encapsulates both the species of success/fail and the actual text of the translation, if any.
Example of a typical use case :
String text = null; LookupResult lookup = Translation.lookUp(aBaseText, aLocale, fTranslations); if( lookup.hasSucceeded() ){ text = lookup.getText(); } else { text = aBaseText; if(LookupResult.UNKNOWN_BASE_TEXT == lookup){ addToListOfUnknowns(aBaseText); } else if (LookupResult.UNKNOWN_LOCALE == lookup){ //do nothing in this implementation } }
Field Summary | |
---|---|
static Translation.LookupResult |
UNKNOWN_BASE_TEXT
BaseText is unknown. |
static Translation.LookupResult |
UNKNOWN_LOCALE
BaseText is known, but no translation exists for the specified Locale |
Method Summary | |
---|---|
String |
getText()
Return the text of the successful translation. |
boolean |
hasSucceeded()
Returns true only if a specific translation exists for BaseText and Locale. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Translation.LookupResult UNKNOWN_BASE_TEXT
public static final Translation.LookupResult UNKNOWN_LOCALE
Method Detail |
---|
public boolean hasSucceeded()
public String getText()
hasSucceeded()
is false.
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |