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.
Modifier and Type | Method and Description |
---|---|
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). |
java.lang.String |
getElementSubject()
Gets the subject of the element that this operation relates to.
|
ContainerOperationType |
getType()
Gets the type of the container operation, which can be an add, remove, insert or remove with
prefix.
|
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. |
ContainerOperationType getType()
java.lang.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.
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
.
java.lang.UnsupportedOperationException
- If this is not an insert
operation.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
.
model
- The container model that will be updated.Please send bug reports and comments to Caplin support