Package com.vaadin.collaborationengine
Class ListOperation
- java.lang.Object
-
- com.vaadin.collaborationengine.ListOperation
-
public class ListOperation extends Object
A list operation providing the list item value, its position, the scope and conditions that should be met for the operation to succeed.- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ListOperationifEmpty()Adds a condition that requires the list to be empty.ListOperationifFirst(ListKey key)Adds a condition that requires the specifiedkeyto be the first in the list.ListOperationifLast(ListKey key)Adds a condition that requires the specifiedkeyto be the last in the list.ListOperationifNext(ListKey key, ListKey nextKey)Adds a condition that requires the specifiednextKeyto be right after the specifiedkeywhen the operation is applied.ListOperationifNotEmpty()Adds a condition that requires the list not to be empty.ListOperationifPrev(ListKey key, ListKey prevKey)Adds a condition that requires the specifiedprevKeyto be right before the specifiedkeywhen the operation is applied.static ListOperationinsertAfter(ListKey after, Object value)Creates a list operation to insert the given value just after the position specified by the given key.static ListOperationinsertBefore(ListKey before, Object value)Creates a list operation to insert the given value just before the position specified by the given key.static ListOperationinsertBetween(ListKey prev, ListKey next, Object value)Creates a list operation to insert the given value between the positions specified by the given keys.static ListOperationinsertFirst(Object value)Creates a list operation to insert the given value as the first item of the list.static ListOperationinsertLast(Object value)Creates a list operation to insert the given value as the last item of the list.ListOperationwithScope(EntryScope scope)Sets the scope of the item affected by this operation.
-
-
-
Method Detail
-
insertFirst
public static ListOperation insertFirst(Object value)
Creates a list operation to insert the given value as the first item of the list.- Parameters:
value- the value, notnull- Returns:
- the list operation, not
null
-
insertLast
public static ListOperation insertLast(Object value)
Creates a list operation to insert the given value as the last item of the list.- Parameters:
value- the value, notnull- Returns:
- the list operation, not
null
-
insertBefore
public static ListOperation insertBefore(ListKey before, Object value)
Creates a list operation to insert the given value just before the position specified by the given key.- Parameters:
before- the position key, notnullvalue- the value, notnull- Returns:
- the list operation, not
null
-
insertAfter
public static ListOperation insertAfter(ListKey after, Object value)
Creates a list operation to insert the given value just after the position specified by the given key.- Parameters:
after- the position key, notnullvalue- the value, notnull- Returns:
- the list operation, not
null
-
insertBetween
public static ListOperation insertBetween(ListKey prev, ListKey next, Object value)
Creates a list operation to insert the given value between the positions specified by the given keys. If the given keys are not adjacent, the operation will fail.- Parameters:
prev- the position of the previous item, notnullnext- the position of the next item, notnullvalue- the value, notnull- Returns:
- the list operation, not
null
-
withScope
public ListOperation withScope(EntryScope scope)
Sets the scope of the item affected by this operation. If not set, the default scope will beEntryScope.TOPIC. Values withEntryScope.CONNECTIONscope will be automatically removed once the connection to the topic which created them is deactivated.- Parameters:
scope- the scope, notnull- Returns:
- this operation, not
null
-
ifNext
public ListOperation ifNext(ListKey key, ListKey nextKey)
Adds a condition that requires the specifiednextKeyto be right after the specifiedkeywhen the operation is applied. AnullnextKeycan be used to represent the tail of the list.- Parameters:
key- the reference key, notnullnextKey- the required key, ornullto represent the tail of the list- Returns:
- this operation, not
null
-
ifLast
public ListOperation ifLast(ListKey key)
Adds a condition that requires the specifiedkeyto be the last in the list.- Parameters:
key- the key, notnull- Returns:
- this operation, not
null
-
ifPrev
public ListOperation ifPrev(ListKey key, ListKey prevKey)
Adds a condition that requires the specifiedprevKeyto be right before the specifiedkeywhen the operation is applied. AnullprevKeycan be used to represent the head of the list.- Parameters:
key- the reference key, notnullprevKey- the required key, ornullto represent the head of the list- Returns:
- this operation, not
null
-
ifFirst
public ListOperation ifFirst(ListKey key)
Adds a condition that requires the specifiedkeyto be the first in the list.- Parameters:
key- the key, notnull- Returns:
- this operation, not
null
-
ifEmpty
public ListOperation ifEmpty()
Adds a condition that requires the list to be empty.- Returns:
- this operation, not
null
-
ifNotEmpty
public ListOperation ifNotEmpty()
Adds a condition that requires the list not to be empty.- Returns:
- this operation, not
null
-
-