Package com.storedobject.core
Interface EditableList<T>
- Type Parameters:
T- Type of items in the list.
- All Known Subinterfaces:
LinkValue<T>,StoredObjectLink<T>
- All Known Implementing Classes:
ContactData,ExtraInfoValue,StoredObjectLink.Copy,StreamAttachmentData
public interface EditableList<T>
API for an "editable list".
- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAad a new item to the list.booleanAad a new item to the list.default voidAppend items to the list.booleanAppend an item to the list.booleanCheck whether the given item is in this list or not.booleanDelete an item from the list.default <R> TgetDuplicate(Function<T, R> value) Get a duplicate entry.booleanCheck if the given item was added to the list or not.booleanCheck if the given item was deleted from the list or not.booleanCheck if the given item was edited or not.default booleanIs save pending?intsize()Size of the list (including all items).stream()Get a stream of all items remaining (after removing deleted items).Get a stream of all newly added items.Get a stream of all items (including original, added, deleted and edited items).Get a stream of all deleted items.Get a stream of all modified items.booleanUndelete an item that was deleted earlier.booleanUpdate an item.
-
Method Details
-
contains
-
isAdded
Check if the given item was added to the list or not.- Parameters:
item- Item to check.- Returns:
- True/false.
-
isDeleted
Check if the given item was deleted from the list or not.- Parameters:
item- Item to check.- Returns:
- True/false.
-
isEdited
Check if the given item was edited or not.- Parameters:
item- Item to check.- Returns:
- True/false.
-
streamAll
-
stream
-
streamAdded
-
streamEdited
-
streamDeleted
-
size
int size()Size of the list (including all items).- Returns:
- Size.
-
append
Append an item to the list. This is not considered as a new item.- Parameters:
item- Item to append.- Returns:
- True if appended, otherwise, false.
-
append
-
add
-
add
Aad a new item to the list.- Parameters:
item- Item to add.- Returns:
- True if added, otherwise, false.
-
delete
Delete an item from the list. (If the item was newly added, it will be removed).- Parameters:
item- Item to delete.- Returns:
- True if deleted, otherwise, false.
-
undelete
Undelete an item that was deleted earlier.- Parameters:
item- Item to undelete.- Returns:
- True if undeleted, otherwise, false.
-
update
Update an item. Item will be marked as modified.- Parameters:
item- Updated item.- Returns:
- True if updated, otherwise, false.
-
isSavePending
default boolean isSavePending()Is save pending? (Some entry has "edited" or "deleted" status).- Returns:
- True/false.
-
getDuplicate
Get a duplicate entry. A function to extract the duplicate value must be passed as the parameter.E.g., from a list of persons, we want to find out a an entry with duplicate "First Name" (to be compared ignoring case):
getDuplicate(p -> p.getFirstName().toUpperCase());Note:
nullvalues are ignored.- Type Parameters:
R- Type of the duplicate value.- Parameters:
value- Function to extract the duplicate value.- Returns:
- Duplicate entry if found, otherwise
null.
-