Class EnumTranslator.EnumEntry<T extends Enum<?>>

java.lang.Object
nz.org.riskscape.engine.i18n.EnumTranslator.EnumEntry<T>
Enclosing class:
EnumTranslator

public class EnumTranslator.EnumEntry<T extends Enum<?>> extends Object

Handles accessing translated strings for a specific enum value

  • Constructor Details

    • EnumEntry

      public EnumEntry(T value)
  • Method Details

    • getLabel

      public String getLabel(Object... args)

      Returns a translated 'label' string for this enum. If no i18n message was found, then the Enum.name() is used (changed to lower-case hyphens, so it looks more parameter-esque).

    • getLabelOr

      public String getLabelOr(String defaultMessage, Object... args)

      Same as getLabel(Object...) except the defaultMessage will be used (rather than the Enum.name() if no i18n message was found.

    • getCode

      public String getCode()
      Returns:
      the base i18n code for this enum value
    • getDescription

      public String getDescription(Object... args)
      Returns:
      a more detailed description for the enum value, e.g. help associated with what it is or does.
    • getValue

      public T getValue()

      The enum value itself

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object