Package de.xima.fc.mdl.enums
Enum EI18nSource
- java.lang.Object
-
- java.lang.Enum<EI18nSource>
-
- de.xima.fc.mdl.enums.EI18nSource
-
- All Implemented Interfaces:
INamedUiElement
,Serializable
,Comparable<EI18nSource>
public enum EI18nSource extends Enum<EI18nSource> implements INamedUiElement
Given a default string and a language-specific string, indicates which string should be used. For example, we could always use the default string; or use the language-specific string and fall back to the default if none is found.- Author:
- XIMA MEDIA GmbH
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CUSTOM_OR_DEFAULT
Use the language-specific string if one exists, otherwise fall back to the default string.DISABLE
Never use a string for a particular language, always use the empty string.USE_DEFAULT
Do not use a language-specific string, always use the default.
-
Field Summary
-
Fields inherited from interface de.xima.fc.interfaces.INamedUiElement
ATTR_DISPLAY_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getDisplayName(Locale locale)
The display name of this element in the given locale.boolean
isAvailable()
abstract String
resolve(String defaultValue, String i18nValue)
Given a default string and a language-specific string, return the string that should actually be used, according to this setting.static EI18nSource
valueOf(String name)
Returns the enum constant of this type with the specified name.static EI18nSource[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
USE_DEFAULT
public static final EI18nSource USE_DEFAULT
Do not use a language-specific string, always use the default.
-
CUSTOM_OR_DEFAULT
public static final EI18nSource CUSTOM_OR_DEFAULT
Use the language-specific string if one exists, otherwise fall back to the default string.
-
DISABLE
public static final EI18nSource DISABLE
Never use a string for a particular language, always use the empty string.
-
-
Method Detail
-
values
public static EI18nSource[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EI18nSource c : EI18nSource.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EI18nSource valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getDisplayName
public String getDisplayName(Locale locale)
Description copied from interface:INamedUiElement
The display name of this element in the given locale.- Specified by:
getDisplayName
in interfaceINamedUiElement
- Parameters:
locale
- The locale to get the display name for.- Returns:
- The display name of this element in the given locale.
-
isAvailable
public boolean isAvailable()
- Returns:
- Whether a string is availble for this setting at all. It is
false
forDISABLE
.
-
resolve
public abstract String resolve(String defaultValue, String i18nValue)
Given a default string and a language-specific string, return the string that should actually be used, according to this setting.- Parameters:
defaultValue
- The default string.i18nValue
- The language-specific string.- Returns:
- The resolved string, depending on this setting. Never returns
null
, only the empty string.
-
-