Package com.lokalized

Class LocalizedString.LanguageFormTranslation

java.lang.Object
com.lokalized.LocalizedString.LanguageFormTranslation
Enclosing class:
LocalizedString

@Immutable public static class LocalizedString.LanguageFormTranslation extends Object
Container for per-language-form (gender, cardinal, ordinal) translation information.

Translations can be keyed either on a single value or a range of values (start and end) in the case of cardinality ranges.

It is required to have either a value or range, but not both.

Author:
Mark Allen
  • Constructor Details

    • LanguageFormTranslation

      public LanguageFormTranslation(@Nonnull String value, @Nonnull Map<LanguageForm,String> translationsByLanguageForm)
      Constructs a per-language-form translation set with the given placeholder value and mapping of translations by language form.
      Parameters:
      value - the placeholder value to compare against for translation, not null
      translationsByLanguageForm - the possible translations keyed by language form, not null
    • LanguageFormTranslation

      public LanguageFormTranslation(@Nonnull LocalizedString.LanguageFormTranslationRange range, @Nonnull Map<LanguageForm,String> translationsByLanguageForm)
      Constructs a per-language-form translation set with the given placeholder range and mapping of translations by language form.
      Parameters:
      range - the placeholder range to compare against for translation, not null
      translationsByLanguageForm - the possible translations keyed by language form, not null
  • Method Details

    • toString

      @Nonnull public String toString()
      Generates a String representation of this object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object, not null
    • equals

      public boolean equals(@Nullable Object other)
      Checks if this object is equal to another one.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to check, null returns false
      Returns:
      true if this is equal to the other object, false otherwise
    • hashCode

      public int hashCode()
      A hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      a suitable hash code
    • getValue

      @Nonnull public Optional<String> getValue()
      Gets the value for this per-language-form translation set.
      Returns:
      the value for this per-language-form translation set, not null
    • getRange

      Gets the range for this per-language-form translation set.
      Returns:
      the range for this per-language-form translation set, not null
    • getTranslationsByLanguageForm

      Gets the translations by language form for this per-language-form translation set.
      Returns:
      the translations by language form for this per-language-form translation set, not null