Package com.storedobject.core
Class ObjectMemoryList<T extends StoredObject>
java.lang.Object
com.storedobject.core.MemoryCache<T>
com.storedobject.core.ObjectMemoryList<T>
- All Implemented Interfaces:
Filtered<T>
,FilterMethods<T>
,ObjectList<T>
,ObjectLoader<T>
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
public class ObjectMemoryList<T extends StoredObject>
extends MemoryCache<T>
implements ObjectList<T>
-
Constructor Summary
ConstructorsConstructorDescriptionObjectMemoryList
(Class<T> objectClass) ObjectMemoryList
(Class<T> objectClass, boolean any) ObjectMemoryList
(Class<T> objectClass, ObjectIterator<T> objects) ObjectMemoryList
(Class<T> objectClass, Query query) ObjectMemoryList
(Class<T> objectClass, Query query, boolean any) ObjectMemoryList
(Class<T> objectClass, Iterable<Id> idList) ObjectMemoryList
(Class<T> objectClass, String condition) ObjectMemoryList
(Class<T> objectClass, String condition, boolean any) ObjectMemoryList
(Class<T> objectClass, String condition, String orderedBy) ObjectMemoryList
(Class<T> objectClass, String condition, String orderedBy, boolean any) ObjectMemoryList
(Class<T> objectClass, Stream<T> objects) -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
boolean
addAll
(int index, Collection<? extends T> collection) boolean
addAll
(Collection<? extends T> collection) void
This method is called whenever a filter predicate is changed.int
Get the load filter.The class of the instances.int
void
load
(int linkType, StoredObject master, String condition, boolean any) Load the links of the given "master" instance.void
load
(ObjectIterator<T> objects) Load the given instances.void
Load the instances created from the query.void
Load the instances created from the list ofId
s.void
Load the instances.void
Load the given instances.void
refresh()
void
void
setProcessor
(Consumer<T> processor) Methods inherited from class com.storedobject.core.MemoryCache
clear, close, contains, containsAll, filter, filter, get, getComparator, getFilter, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, order, remove, remove, removeAll, removeIf, retainAll, set, size, size, sizeAll, sort, stream, streamAll, subList, toArray, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.storedobject.core.Filtered
filter, filter, getComparator, getFilter, order, size, size, sizeAll, stream, streamAll
Methods inherited from interface com.storedobject.core.FilterMethods
getEffectiveCondition, getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilter
Methods inherited from interface java.util.List
addFirst, addLast, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, subList, toArray, toArray
Methods inherited from interface com.storedobject.core.ObjectList
clear, close, idStream, idStreamAll, isEmpty
Methods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getOrderBy, isAllowAny, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, reload, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderBy, size
-
Constructor Details
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
ObjectMemoryList
-
-
Method Details
-
load
Description copied from interface:ObjectLoader
Load the instances. Current "load filter" if set will be applied. If "master" is already set, "links" of the "master" will be loaded.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
condition
- Filtering condition to be applied.orderedBy
- "ORDER BY" clause to use while loading.any
- Whether instanced of the subclasses to be retrieved or not.
-
load
Description copied from interface:ObjectLoader
Load the links of the given "master" instance. Current "load filter" if set will be applied. The order will be determined by the return value ofObjectLoader.getOrderBy()
.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
linkType
- Link type.master
- Master instance.condition
- Filtering condition to be applied.any
- Whether instanced of the subclasses to be retrieved or not.
-
load
Description copied from interface:ObjectLoader
Load the instances created from the query. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
query
- Query from which objects to be loaded.any
- Whether instanced of the subclasses to be retrieved or not.
-
load
Description copied from interface:ObjectLoader
Load the instances created from the list ofId
s. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored. Also, the value returned byObjectLoader.getAllowAny()
will determine whether instanced of the subclasses to be restricted or not.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
idList
- List ofId
s from which objects to be loaded.
-
load
Description copied from interface:ObjectLoader
Load the given instances. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored. Also, the value returned byObjectLoader.getAllowAny()
will determine whether instanced of the subclasses to be restricted or not.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
objects
- Objects to be loaded.
-
load
Description copied from interface:ObjectLoader
Load the given instances. Current "load filter" if set will be applied. However,ObjectLoader.getOrderBy()
result will be ignored. Also, the value returned byObjectLoader.getAllowAny()
will determine whether instanced of the subclasses to be restricted or not.- Specified by:
load
in interfaceObjectLoader<T extends StoredObject>
- Parameters:
objects
- Objects to be loaded.
-
applyFilterPredicate
public void applyFilterPredicate()Description copied from interface:FilterMethods
This method is called whenever a filter predicate is changed. Methods with default implementation already invoke this method. If any of those methods are overridden, make sure that it invokes this method so that logic to handle filter changes can be coded here.Note: This method is used to show the filtered result of the existing entries
- Specified by:
applyFilterPredicate
in interfaceFilterMethods<T extends StoredObject>
-
getLoadFilter
Description copied from interface:FilterMethods
Get the load filter.- Specified by:
getLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Returns:
- Current load filter.
-
getObjectClass
Description copied from interface:ObjectLoader
The class of the instances.- Specified by:
getObjectClass
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- The class of the instances to load.
-
add
- Specified by:
add
in interfaceObjectList<T extends StoredObject>
-
indexOf
- Specified by:
indexOf
in interfaceObjectList<T extends StoredObject>
-
refresh
public void refresh()- Specified by:
refresh
in interfaceObjectList<T extends StoredObject>
-
refresh
- Specified by:
refresh
in interfaceObjectList<T extends StoredObject>
-
refresh
- Specified by:
refresh
in interfaceObjectList<T extends StoredObject>
-
getCacheLevel
public int getCacheLevel()- Specified by:
getCacheLevel
in interfaceObjectList<T extends StoredObject>
-
setLoader
-
getLoader
-
add
- Specified by:
add
in interfaceCollection<T extends StoredObject>
- Specified by:
add
in interfaceList<T extends StoredObject>
- Overrides:
add
in classMemoryCache<T extends StoredObject>
-
add
- Specified by:
add
in interfaceList<T extends StoredObject>
- Overrides:
add
in classMemoryCache<T extends StoredObject>
-
addAll
- Specified by:
addAll
in interfaceCollection<T extends StoredObject>
- Specified by:
addAll
in interfaceList<T extends StoredObject>
- Overrides:
addAll
in classMemoryCache<T extends StoredObject>
-
addAll
- Specified by:
addAll
in interfaceList<T extends StoredObject>
- Overrides:
addAll
in classMemoryCache<T extends StoredObject>
-
setProcessor
- Specified by:
setProcessor
in interfaceObjectList<T extends StoredObject>
-