Class EnumLocalizeNameHelper<EnumType extends Enum<?>>


  • public final class EnumLocalizeNameHelper<EnumType extends Enum<?>>
    extends Object
    Utility class that provides utility methods to return a localized string for a given enum type constant in the specified resource bundle.
    Author:
    Paulo Zenida - Linkare TI
    • Constructor Detail

      • EnumLocalizeNameHelper

        private EnumLocalizeNameHelper()
        Hiding constructor so that this utility class cannot be instantiated from outside.
    • Method Detail

      • getLocalizedName

        public static <EnumType extends Enum<?>> String getLocalizedName​(EnumType enumType,
                                                                         ResourceBundle bundle)
        Type Parameters:
        EnumType - the type of the enum whose constant we are looking for.
        Parameters:
        enumType - the enum constant we are looking for.
        bundle - the bundle where the enumType should be looked in.
        Returns:
        Returns the localized name of the enumType in the bundle specified, if both the enumType and the bundle are not null. The bundle key format is '.'. It returns false otherwise. E.g., for one enum type named Gender, containing MALE and FEMALE as its members:
        Enum type Searching key
        MALE Gender.MALE
        FEMALE Gender.FEMALE