Interface ListOperation


public interface ListOperation
Interface that represents a list operation.

 

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

 

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

 

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

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    If this is an insert operation, this method returns the position in the list 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 list operation, which can be an add, remove, insert or remove with prefix.
  • Method Details

    • getType

      Gets the type of the list operation, which can be an add, remove, insert or remove with prefix.
      Returns:
      The list 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 list 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.