Class ReferenceList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<ReferenceItem>, java.util.Collection<ReferenceItem>, java.util.List<ReferenceItem>, java.util.RandomAccess

    public class ReferenceList
    extends java.util.ArrayList<ReferenceItem>
    This class provides the structure for a list of references values Each element includes a code and a name
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ReferenceList()
      Default constructor.
      ReferenceList​(int nInitialCapacity)
      Creates a new reference list with a specified initial capacity.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addItem​(int nCode, java.lang.String strName)
      This method converts the int code specified in parameter as a String and adds a new element (code, name) to the list
      void addItem​(java.lang.String strCode, java.lang.String strName)
      This method adds a new element (code, name) to the list
      void checkItems​(java.lang.String[] valuesToCheck)
      CheckItems when are selected
      static ReferenceList convert​(java.util.Collection collection, java.lang.String strCodeAttribute, java.lang.String strNameAttribute, boolean bNumericCode)
      Converts a collection to a ReferenceList
      static ReferenceList convert​(java.util.Map<java.lang.String,​java.lang.String> map)
      Convert a Map<String, String> into a ReferenceList
      java.util.Map<java.lang.String,​java.lang.String> toMap()
      Convert the ReferenceList into a map
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • ReferenceList

        public ReferenceList()
        Default constructor.
      • ReferenceList

        public ReferenceList​(int nInitialCapacity)
        Creates a new reference list with a specified initial capacity.
        Parameters:
        nInitialCapacity - The initial capacity of the collection
    • Method Detail

      • addItem

        public void addItem​(java.lang.String strCode,
                            java.lang.String strName)
        This method adds a new element (code, name) to the list
        Parameters:
        strCode - The code as a String
        strName - The name corresponding to the code as a String
      • addItem

        public void addItem​(int nCode,
                            java.lang.String strName)
        This method converts the int code specified in parameter as a String and adds a new element (code, name) to the list
        Parameters:
        nCode - The code to convert an add
        strName - The name corresponding to the code as a String
      • convert

        public static ReferenceList convert​(java.util.Collection collection,
                                            java.lang.String strCodeAttribute,
                                            java.lang.String strNameAttribute,
                                            boolean bNumericCode)
        Converts a collection to a ReferenceList
        Parameters:
        collection - The collection to convert
        strCodeAttribute - The name of the code attribute. Ex : "id" to call getId()
        strNameAttribute - The name of the code attribute. Ex : "name" to call getName()
        bNumericCode - true if the code getter returns an Integer, false otherwise
        Returns:
        The ReferenceList filled
        Since:
        v1.1
      • convert

        public static ReferenceList convert​(java.util.Map<java.lang.String,​java.lang.String> map)
        Convert a Map<String, String> into a ReferenceList
        Parameters:
        map - the map to convert
        Returns:
        the converted ReferenceList
      • toMap

        public java.util.Map<java.lang.String,​java.lang.String> toMap()
        Convert the ReferenceList into a map
        Returns:
        the converted map
      • checkItems

        public void checkItems​(java.lang.String[] valuesToCheck)
        CheckItems when are selected
        Parameters:
        valuesToCheck - The list of string