Interface ContainerOperation
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 TypeMethodDescriptionintIf this is aninsertoperation, 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.getType()Gets the type of the container operation, which can be an add, remove, insert or remove with prefix.voidupdateContainer(ContainerModel model) If you have defined a model of the container by implementingContainerModel, call this method from within your implementation to update the model according to the operation.
-
Method Details
-
getType
ContainerOperationType 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,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 container 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.
-
updateContainer
If you have defined a model of the container by implementingContainerModel, call this method from within your implementation to update the model according to the operation. The method invokes the relevant operation callback method on theContainerModel.For further details on how to use this method, see
ContainerModel.- Parameters:
model- The container model that will be updated.
-