Class CmsIdentifiableObjectContainer<T>

  • Type Parameters:
    T - the type of objects

    public class CmsIdentifiableObjectContainer<T>
    extends java.lang.Object
    Default implementation of a named object container.

    It can handle relative or absolute orderings and unique names.

    Since:
    6.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsIdentifiableObjectContainer​(boolean uniqueIds, boolean relativeOrdered)
      Default Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIdentifiableObject​(java.lang.String id, T idObject)
      Appends the specified object to the end of this container.
      void addIdentifiableObject​(java.lang.String id, T idObject, float position)
      Inserts the specified object at the specified position in this container.
      void clear()
      Resets the container.
      java.util.List<T> elementList()
      Returns the list of objects.
      T getObject​(java.lang.String id)
      Returns the object with the given id.
      java.util.List<T> getObjectList​(java.lang.String id)
      Returns the list of objects with the given id.
      void removeObject​(java.lang.String id)
      Removes an object with the given id.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsIdentifiableObjectContainer

        public CmsIdentifiableObjectContainer​(boolean uniqueIds,
                                              boolean relativeOrdered)
        Default Constructor.

        Parameters:
        uniqueIds - if the list show check for unique ids
        relativeOrdered - if the list show use relative ordering, instead of absolute ordering
    • Method Detail

      • addIdentifiableObject

        public void addIdentifiableObject​(java.lang.String id,
                                          T idObject)
        Appends the specified object to the end of this container.

        Parameters:
        id - the object identifier
        idObject - the object add to the container
        See Also:
        List.add(Object)
      • addIdentifiableObject

        public void addIdentifiableObject​(java.lang.String id,
                                          T idObject,
                                          float position)
        Inserts the specified object at the specified position in this container.

        Shifts the object currently at that position (if any) and any subsequent objects to the right (adds one to their indices).

        Parameters:
        id - the object identifier
        idObject - the object add to the container
        position - the insertion point
        See Also:
        List.add(int, Object)
      • clear

        public void clear()
        Resets the container.

      • elementList

        public java.util.List<TelementList()
        Returns the list of objects.

        Returns:
        the a list of Objects.
      • getObject

        public T getObject​(java.lang.String id)
        Returns the object with the given id.

        If uniqueIds is set to false an Object containing a List with all the objects with the given id is returned.

        If the container no contains any object with the given id, null is returned.

        Parameters:
        id - the id of the object
        Returns:
        the object if found, or null
        See Also:
        Map.get(Object)
      • getObjectList

        public java.util.List<TgetObjectList​(java.lang.String id)
        Returns the list of objects with the given id.

        Parameters:
        id - the object id
        Returns:
        the list of objects if found, or null
      • removeObject

        public void removeObject​(java.lang.String id)
        Removes an object with the given id.

        if m_uniqueIds is set, it will remove at most one object. otherwise it will remove all elements with the given id.

        Parameters:
        id - the id of the object to remove