Interface ContainerOperation


public interface ContainerOperation

Interface that represents a container operation.

 

Examples of container operations are: Add an element to the end of the container, insert an element at a given position in the container, remove an element from the container, remove elements from the container that have a subject matching a specified prefix.

 

You add operations to a container message by calling the appropriate methods of ContainerMessage, such as ContainerMessage.addElement(String) and ContainerMessage.removeElement(String).

 

You can obtain the operations defined in a ContainerMessage by calling its ContainerMessage.getOperations() method.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    If this is an insert operation, this method returns the position in the container where the element is to be inserted (the first position is position 0).
    Gets the subject of the element that this operation relates to.
    Gets the type of the container operation, which can be an add, remove, insert or remove with prefix.
    void
    If you have defined a model of the container by implementing ContainerModel, call this method from within your implementation to update the model according to the operation.
  • Method Details

    • getType

      Gets the type of the container operation, which can be an add, remove, insert or remove with prefix.
      Returns:
      The container operation type.
    • getElementSubject

      String getElementSubject()

      Gets the subject of the element that this operation relates to.

       

      If this is an add, remove or insert operation, the method returns the subject of the element.

       

      If this is a remove with prefix operation, the method returns the prefix that specifies the elements to remove.

      Returns:
      The subject or prefix of the element that this operation relates to.
    • getElementPosition

      int getElementPosition()

      If this is an insert operation, this method returns the position in the container where the element is to be inserted (the first position is position 0).

       

      If this is an add, remove or remove with prefix operation, the method throws an UnsupportedOperationException.

      Returns:
      The position at which to insert the element.
      Throws:
      UnsupportedOperationException - If this is not an insert operation.
    • updateContainer

      void updateContainer(ContainerModel model)

      If you have defined a model of the container by implementing ContainerModel, call this method from within your implementation to update the model according to the operation. The method invokes the relevant operation callback method on the ContainerModel.

       

      For further details on how to use this method, see ContainerModel.

      Parameters:
      model - The container model that will be updated.