Class EnumTranslator

java.lang.Object
nz.org.riskscape.engine.i18n.EnumTranslator

public class EnumTranslator extends Object

Helper for handling translation of Enum values for user help, CLI display, etc.

  • Constructor Details

    • EnumTranslator

      public EnumTranslator(nz.org.riskscape.engine.i18n.TranslationContext context)
  • Method Details

    • getEntries

      public <T extends Enum<?>> List<EnumTranslator.EnumEntry<T>> getEntries(Class<T> enumClass)
      Returns:
      a list of EnumTranslator.EnumEntrys that correspond to the constants/values for the given enum. This makes it easier to access/display the translated text for an enum.
    • getEntry

      public <T extends Enum<?>> EnumTranslator.EnumEntry<T> getEntry(T enumValue)
      Returns:
      a single EnumEntry for the given enumValue, linked to this EnumTranslator's i18n state.