Class DynamicEnum

    • Constructor Detail

      • DynamicEnum

        public DynamicEnum​(Iterable<String> values)
        Creates a new DynamicEnum. Note that it is the responsibility of the consumer to construct instances of DynamicEnum in such a way that there will not be two instances of the "same" DynamicEnum present in the same hashmap at the same time.
        Parameters:
        values - the values of this enum
    • Method Detail

      • forOrdinal

        public DynamicEnum.Value forOrdinal​(int ordinal)
        Returns the Value that corresponds to the given ordinal.
        Parameters:
        ordinal - The ordinal.
        Returns:
        the Value that corresponds to the given ordinal.
        Throws:
        ArrayIndexOutOfBoundsException - If ordinal is not a valid ordinal.
      • forName

        public DynamicEnum.Value forName​(String name)
        Returns the Value that corresponds to the given name.
        Parameters:
        name - The name.
        Returns:
        the value or null if name is not a valid name or name is null
      • names

        public Set<String> names()
        Returns the set of names. The returned set will be ordered by ordinal.
        Returns:
        the set of names.
      • namesList

        public List<String> namesList()
        Returns the list of names. The returned list will be ordered by ordinal.
        Returns:
        the list of names.
      • size

        public int size()
        Returns the number of values in the enumeration.
        Returns:
        the number of values in the enumeration.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object