Class LocalizedString.ExpressionTranslation
java.lang.Object
com.lokalized.LocalizedString.PlaceholderDefinition
com.lokalized.LocalizedString.ExpressionTranslation
- Enclosing class:
LocalizedString
@Immutable
public static final class LocalizedString.ExpressionTranslation
extends LocalizedString.PlaceholderDefinition
A generated fragment with a required default translation and optional ordered expression-driven alternatives.
The first alternative whose expression matches supplies the fragment. If none match, the default translation is used. The one-argument constructor creates a translation-only scoped fragment.
- Since:
- 3.0.0
- Author:
- Mark Allen
-
Constructor Summary
ConstructorsConstructorDescriptionExpressionTranslation(@NonNull String translation) Constructs a translation-only generated fragment.ExpressionTranslation(@NonNull String translation, @NonNull List<@NonNull LocalizedString.ExpressionAlternative> alternatives) Constructs a generated fragment with a default translation and ordered expression-driven alternatives. -
Method Summary
-
Constructor Details
-
ExpressionTranslation
Constructs a translation-only generated fragment.- Parameters:
translation- the fragment translation, not null
-
ExpressionTranslation
public ExpressionTranslation(@NonNull String translation, @NonNull List<@NonNull LocalizedString.ExpressionAlternative> alternatives) Constructs a generated fragment with a default translation and ordered expression-driven alternatives.- Parameters:
translation- the default fragment translation, not nullalternatives- the ordered expression-driven alternatives, not null or empty- Throws:
NullPointerException- ifalternativescontains a null element
-
-
Method Details
-
toString
-
equals
-
hashCode
-
getTranslation
Gets the default fragment translation.- Returns:
- the default fragment translation, not null
-
getAlternatives
Gets the ordered expression-driven alternatives.- Returns:
- the ordered expression-driven alternatives, empty for a translation-only fragment, not null
-