protected Map<String, Object> getEnumValues(FacesContext facesContext, Class<?> type, String allSuffix) {

        if (type.isEnum()) {

            // allSuffix was not considered by the cache.
            // allSuffix now got deprecated. If still used, create a new map each time.
            boolean cacheEnabled = allSuffix == null && facesContext.isProjectStage(ProjectStage.Production);
            Map<Class<?>, Map<String, Object>> cache
                    = PrimeApplicationContext.getCurrentInstance(FacesContext.getCurrentInstance()).getEnumCacheMap();

            if (allSuffix != null && facesContext.isProjectStage(ProjectStage.Development)) {
                LOG.info("The allSuffix attribute of '<p:importEnum/>' is deprecated and will be removed in a "
                        + "future version. Please use the 'ALL_VALUES' attribute to access all enum values.");
            }

            Map<String, Object> enums;

            if (cacheEnabled && cache.containsKey(type)) {
                enums = cache.get(type);
            }
            else {
                enums = new EnumHashMap<>(type);

                enums.put(DEFAULT_ALL_SUFFIX, type.getEnumConstants());

                for (Object value : type.getEnumConstants()) {
                    Enum<?> currentEnum = (Enum<?>) value;
                    enums.put(currentEnum.name(), currentEnum);
                }

                if (allSuffix != null) {
                    enums.put(allSuffix, type.getEnumConstants());
                }

                enums = Collections.unmodifiableMap(enums);

                if (cacheEnabled) {
                    cache.put(type, enums);
                }
            }

            return enums;
        }
        else {
            throw new FacesException("Class '" + type + "' is not an enum.");
        }
    }
Get all enum values of the given {@link Class}.

@param facesContext The {@link FacesContext}.
@param type         The enum class.
@param allSuffix    The suffix to access a array with all enum values.
@return A {@link Map} with the enum values.
primefaces/src/main/java/org/primefaces/component/importenum/ImportEnumTagHandler.java