Module jonix.common

Class ListOfOnixCodelist<E extends OnixElement<V>,V extends OnixCodelist>

Type Parameters:
E - the type of the OnixElement containing the OnixCodelist
V - the type of the OnixCodelist enum
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class ListOfOnixCodelist<E extends OnixElement<V>,V extends OnixCodelist> extends ListOfOnixElement<E,V>
Stores a list of OnixCodelists, each of which is a Java Enum containing a code and a description. It is used with OnixElements that are repeatable, i.e. can indicate more than one codelist (for example <ProductFormDetail>).
See Also:
  • Constructor Details

    • ListOfOnixCodelist

      public ListOfOnixCodelist()
  • Method Details

    • pairs

      public List<OnixCodelist.Pair> pairs()
      Given the OnixCodelists stored in this container, this method returns a String-based (code,description) list of tuples. It is a "type-free" representation of the codelists, suitable for cross-comparisons.
      Returns:
      a non-null, possibly empty, list of code+description pairs
    • pairsMap

      public Map<String,String> pairsMap()
      Given the OnixCodelists stored in this container, this method returns a String-based map of (code -> description) entries. It is a "type-free" representation of the codelists, suitable for cross-comparisons.
      Returns:
      a non-null, possibly empty, map of code->description
    • codes

      public Set<String> codes()
      Returns:
      a non-null, possibly empty, set of all the OnixCodelist's codes stored in this container
    • descriptions

      public Collection<String> descriptions()
      Returns:
      a non-null, possibly empty, set of all the OnixCodelist's descriptionss stored in this container
    • pairsInto

      public <C extends Collection<OnixCodelist.Pair>> C pairsInto(C collection)
      stores into a given Collection the (String,String) code+description pairs stored within the elements of this container
      Returns:
      the same passed collection, after being populated
    • firstPair

      public Optional<OnixCodelist.Pair> firstPair()
      Returns:
      an Optional of the first OnixCodelist listed, if any, wrapped as a code+description OnixCodelist.Pair
    • firstPairOrNull

      public OnixCodelist.Pair firstPairOrNull()
      Returns:
      the first OnixCodelist listed, if any, wrapped as a code+description OnixCodelist.Pair, or null if none is listed
    • emptyList

      public static <X extends OnixElement<Y>, Y extends OnixCodelist> ListOfOnixCodelist<X,Y> emptyList()