Class CmsIdentifiableObjectContainer<T>

java.lang.Object
org.opencms.workplace.tools.CmsIdentifiableObjectContainer<T>
Type Parameters:
T - the type of objects

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

It can handle relative or absolute orderings and unique names.

Since:
6.0.0
  • Constructor Details

    • 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 Details

    • addIdentifiableObject

      public void addIdentifiableObject(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:
    • addIdentifiableObject

      public void addIdentifiableObject(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:
    • clear

      public void clear()
      Resets the container.

    • elementList

      public List<T> elementList()
      Returns the list of objects.

      Returns:
      the a list of Objects.
    • getObject

      public T getObject(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:
    • getObjectList

      public List<T> getObjectList(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(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