Interface ListOperation
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 TypeMethodDescriptionintIf this is aninsertoperation, 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.getType()Gets the type of the list operation, which can be an add, remove, insert or remove with prefix.
-
Method Details
-
getType
ListOperationType 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,removeorinsertoperation, the method returns the subject of the element.If this is a
remove with prefixoperation, 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 aninsertoperation, 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,removeorremove with prefixoperation, the method throws anUnsupportedOperationException.- Returns:
- The position at which to insert the element.
- Throws:
UnsupportedOperationException- If this is not aninsertoperation.
-