Class DynamicEnum.Coproduct<T>

java.lang.Object
eu.bandm.tools.util.DynamicEnum<Map.Entry<Integer,T>>
eu.bandm.tools.util.DynamicEnum.Coproduct<T>
All Implemented Interfaces:
Index<DynamicEnum.Item<Map.Entry<Integer,T>>>, Serializable, Iterable<DynamicEnum.Item<Map.Entry<Integer,T>>>
Enclosing class:
DynamicEnum<T>

public static class DynamicEnum.Coproduct<T> extends DynamicEnum<Map.Entry<Integer,T>>
An enumeration type which comprises all items from a set of underlying enumeration types. Every emtry of this coproduct enumeration is implemented by a Map.Entry of the underlying enumeration (given as an integer index) and a value of this enumeration.
See Also:
  • Constructor Details

    • Coproduct

      public Coproduct(List<? extends DynamicEnum<? extends T>> cases)
      Construct a coproduct enumeration from a list of DynamicEnum, which define the items by joining in the given sequential order.
  • Method Details

    • injection

      public DynamicEnum.Item<Map.Entry<Integer,T>> injection(int index, DynamicEnum.Item<? extends T> item)
      Deliver the item of the coproduct enumeration which corresponds to the givne item of one of the underlying enumerations.
      Parameters:
      index - identifies the underlying enumeration, in the sequential order of the constructor arguments
      item - must be contained in the selected underlying enumeration.
      Throws:
      IllegalArgumentException - if the given item is not in the underlying enumeration (given by index)