Package adams.core

Class ConfigurableEnumeration<T extends ConfigurableEnumeration.AbstractItem>

    • Constructor Detail

      • ConfigurableEnumeration

        public ConfigurableEnumeration()
        Initializes the enumeration.
    • Method Detail

      • initialize

        protected abstract T[] initialize()
        Initializes the items.
        Returns:
        the items
      • check

        protected T[] check​(T[] items)
        Checks the uniqueness of the items. Also ensures that items are not null.
        Parameters:
        items - the items to check
        Returns:
        the items
        Throws:
        IllegalArgumentException - if not unique or null
      • values

        public T[] values()
        Returns the items of the enumeration.
        Returns:
        the items
      • parse

        public T parse​(String s)
        Parses the given string and returns the associated Item, making use of label and ID.
        Parameters:
        s - the string to parse
        Returns:
        the item, null if failed to locate item
      • newItem

        public abstract T newItem​(String id,
                                  String display)
        Initializes the enum type.
        Parameters:
        id - the ID of the enum type, can be null
        display - the display text, can be null
      • toString

        public String toString()
        Just returns all the underlying items as comma-separated list.
        Overrides:
        toString in class Object
        Returns:
        the items as list