Class IntegerValuedEnumHelper


  • public final class IntegerValuedEnumHelper
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Enum<T> & IntegerValuedEnum>
      java.util.EnumSet<T>
      enumSetOf​(java.lang.Class<T> enumType, int integerValue)
      Returns a set of enum values from an integer value.
      static <T extends java.lang.Enum<T> & IntegerValuedEnum>
      T
      fromIntValue​(java.lang.Class<T> enumType, int integerValue)  
      static <T extends java.lang.Enum<T> & IntegerValuedEnum>
      int
      valueOf​(java.util.EnumSet<T> enumSet)
      Returns an integer value of a set of enum values.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntegerValuedEnumHelper

        public IntegerValuedEnumHelper()
    • Method Detail

      • fromIntValue

        public static <T extends java.lang.Enum<T> & IntegerValuedEnum> T fromIntValue​(java.lang.Class<T> enumType,
                                                                                       int integerValue)
      • valueOf

        public static <T extends java.lang.Enum<T> & IntegerValuedEnum> int valueOf​(java.util.EnumSet<T> enumSet)
        Returns an integer value of a set of enum values.
        Parameters:
        enumSet - set of enum values
        Returns:
        the integer value of the set of enum values
      • enumSetOf

        public static <T extends java.lang.Enum<T> & IntegerValuedEnum> java.util.EnumSet<T> enumSetOf​(java.lang.Class<T> enumType,
                                                                                                       int integerValue)
        Returns a set of enum values from an integer value.
        Parameters:
        enumType - the type of the enum (needed because of type erasure)
        integerValue - the value from which to compute the set of enum values
        Returns:
        an enumset corresponding to the integer value or an empty enum set if a combination of enum values of the given enum type cannot be found.