Interface EnumerationService

  • All Known Implementing Classes:
    DefaultEnumerationService

    public interface EnumerationService
    Provides helpful methods to work with the Enumeration Types.
    Spring Bean ID:
    enumerationService
    • Method Detail

      • getEnumerationValues

        <T extends HybrisEnumValue> java.util.List<T> getEnumerationValues​(java.lang.String enumerationCode)
        Returns all Enumerations with matching given enumeration code.
        Parameters:
        enumerationCode - the code of the Enumeration type, e.g. ArticleApprovalStatus.
        Returns:
        List of HybrisEnumValue
        Throws:
        java.lang.IllegalArgumentException - if given parameter is null.
        UnknownIdentifierException - if given parameter could not be found.
      • getEnumerationValues

        <T extends HybrisEnumValue> java.util.List<T> getEnumerationValues​(java.lang.Class<T> enumClass)
        Returns all Enumerations for given enumeration class.
        Parameters:
        enumClass - the enumeration class, e.g. ArticleApprovalStatus. This can either be fixed or dynamic enumeration class.
        Returns:
        List of HybrisEnumValue
        Throws:
        java.lang.IllegalArgumentException - if given parameter is null.
        UnknownIdentifierException - if given parameter could not be found.
      • getEnumerationValue

        <T extends HybrisEnumValue> T getEnumerationValue​(java.lang.String enumerationCode,
                                                          java.lang.String valueCode)
        Returns the Enumeration with matching given enumeration code and value.
        Parameters:
        enumerationCode - the code of the Enumeration type, e.g. ArticleApprovalStatus.
        valueCode - the value code of the Enumeration item, e.g. check, approval, etc...
        Returns:
        Enumeration value as HybrisEnumValue implementation
        Throws:
        java.lang.IllegalArgumentException - if given parameters are null.
        UnknownIdentifierException - if given parameters could not be found.
      • getEnumerationValue

        <T extends HybrisEnumValue> T getEnumerationValue​(java.lang.Class<T> enumClass,
                                                          java.lang.String valueCode)
        Returns the Enumeration with matching given enumeration class and value.
        Parameters:
        enumClass - the enumeration class, e.g. ArticleApprovalStatus. This can either be fixed or dynamic enumeration class.
        valueCode - the value code of the Enumeration item, e.g. check, approval, etc...
        Returns:
        Enumeration value as HybrisEnumValue implementation
        Throws:
        java.lang.IllegalArgumentException - if given parameters are null.
        UnknownIdentifierException - if given parameters could not be found.
      • getEnumerationName

        java.lang.String getEnumerationName​(HybrisEnumValue enumValue)
        Provides name for enumeration value (in the current language).
        Parameters:
        enumValue - the value
        Returns:
        the enum localized name
      • setEnumerationName

        void setEnumerationName​(HybrisEnumValue enumValue,
                                java.lang.String name)
        Changes name for enumeration value (in the current language).
        Parameters:
        enumValue - the value
        name - the new name
      • getEnumerationName

        java.lang.String getEnumerationName​(HybrisEnumValue enumValue,
                                            java.util.Locale locale)
        Provides name for enumeration value using the given locale.
        Parameters:
        enumValue - the value
        locale - the locale to match
        Returns:
        the enum localized name
      • setEnumerationName

        void setEnumerationName​(HybrisEnumValue enumValue,
                                java.lang.String name,
                                java.util.Locale locale)
        Changes name for enumeration value using the given locale.
        Parameters:
        enumValue - the value
        locale - the locale to match
        name - the new name