Package com.storedobject.core
Class ObjectCacheList<T extends StoredObject>
java.lang.Object
com.storedobject.core.ObjectCacheList<T>
- All Implemented Interfaces:
Filtered<T>
,FilterMethods<T>
,ObjectList<T>
,ObjectLoader<T>
,AutoCloseable
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
public class ObjectCacheList<T extends StoredObject>
extends Object
implements ObjectList<T>, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionObjectCacheList
(Class<T> objectClass) ObjectCacheList
(Class<T> objectClass, boolean any) ObjectCacheList
(Class<T> objectClass, ObjectIterator<T> objects) ObjectCacheList
(Class<T> objectClass, Query query) ObjectCacheList
(Class<T> objectClass, Query query, boolean any) ObjectCacheList
(Class<T> objectClass, Iterable<Id> idList) ObjectCacheList
(Class<T> objectClass, String condition) ObjectCacheList
(Class<T> objectClass, String condition, boolean any) ObjectCacheList
(Class<T> objectClass, String condition, String orderedBy) ObjectCacheList
(Class<T> objectClass, String condition, String orderedBy, boolean any) ObjectCacheList
(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.void
clear()
Clear - remove all entries.void
close()
boolean
boolean
containsAll
(Collection<?> c) void
void
filter
(Predicate<? super T> filter, Comparator<? super T> comparator) get
(int index) int
final Comparator
<? super T> Get the load filter.The class of the instances.idStream
(int startingIndex, int endingIndex) idStreamAll
(int startingIndex, int endingIndex) int
int
boolean
Retrieve sub-classes?boolean
isEmpty()
iterator()
int
listIterator
(int index) 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
order
(Comparator<? super T> comparator) void
refresh()
remove
(int index) boolean
boolean
removeAll
(Collection<?> collection) boolean
boolean
retainAll
(Collection<?> collection) void
setLoadFilter
(Predicate<T> loadFilter) Set the load filter.void
setProcessor
(Consumer<T> processor) int
size()
Get the instances count.int
size
(int startingIndex, int endingIndex) int
sizeAll()
void
sort
(Comparator<? super T> comparator) stream
(int startingIndex, int endingIndex) streamAll
(int startingIndex, int endingIndex) subList
(int fromIndex, int toIndex) Object[]
toArray()
<O> O[]
toArray
(O[] a) 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, stream, toArray
Methods inherited from interface com.storedobject.core.FilterMethods
getEffectiveCondition, getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setViewFilter, setViewFilter
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, spliterator
Methods inherited from interface com.storedobject.core.ObjectLoader
applyFilter, canContain, getAllowAny, getLinkType, getMaster, getOrderBy, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, load, reload, setLinkType, setLinkType, setMaster, setMaster, setOrderBy, setOrderBy
-
Constructor Details
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
ObjectCacheList
-
-
Method Details
-
setLoadFilter
Description copied from interface:FilterMethods
Set the load filter. This will be applied whenever loading takes place.- Specified by:
setLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Parameters:
loadFilter
- Load filter to be applied while loading.
-
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.
-
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 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.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceObjectList<T extends StoredObject>
-
isAllowAny
public boolean isAllowAny()Description copied from interface:ObjectLoader
Retrieve sub-classes?- Specified by:
isAllowAny
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Whether instanced of the subclasses to be retrieved or not.
-
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.
-
size
public int size()Description copied from interface:ObjectLoader
Get the instances count.- Specified by:
size
in interfaceCollection<T extends StoredObject>
- Specified by:
size
in interfaceFiltered<T extends StoredObject>
- Specified by:
size
in interfaceList<T extends StoredObject>
- Specified by:
size
in interfaceObjectLoader<T extends StoredObject>
- Returns:
- Count.
-
size
public int size(int startingIndex, int endingIndex) - Specified by:
size
in interfaceFiltered<T extends StoredObject>
-
sizeAll
public int sizeAll()- Specified by:
sizeAll
in interfaceFiltered<T extends StoredObject>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<T extends StoredObject>
- Specified by:
isEmpty
in interfaceList<T extends StoredObject>
- Specified by:
isEmpty
in interfaceObjectList<T extends StoredObject>
-
contains
- Specified by:
contains
in interfaceCollection<T extends StoredObject>
- Specified by:
contains
in interfaceList<T extends StoredObject>
-
iterator
- Specified by:
iterator
in interfaceCollection<T extends StoredObject>
- Specified by:
iterator
in interfaceIterable<T extends StoredObject>
- Specified by:
iterator
in interfaceList<T extends StoredObject>
-
toArray
- Specified by:
toArray
in interfaceCollection<T extends StoredObject>
- Specified by:
toArray
in interfaceList<T extends StoredObject>
-
toArray
@Nonnull public <O> O[] toArray(@Nonnull O[] a) - Specified by:
toArray
in interfaceCollection<T extends StoredObject>
- Specified by:
toArray
in interfaceList<T extends StoredObject>
-
add
- Specified by:
add
in interfaceCollection<T extends StoredObject>
- Specified by:
add
in interfaceList<T extends StoredObject>
-
add
- Specified by:
add
in interfaceObjectList<T extends StoredObject>
-
remove
- Specified by:
remove
in interfaceCollection<T extends StoredObject>
- Specified by:
remove
in interfaceList<T extends StoredObject>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T extends StoredObject>
- Specified by:
containsAll
in interfaceList<T extends StoredObject>
-
addAll
- Specified by:
addAll
in interfaceCollection<T extends StoredObject>
- Specified by:
addAll
in interfaceList<T extends StoredObject>
-
addAll
- Specified by:
addAll
in interfaceList<T extends StoredObject>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<T extends StoredObject>
- Specified by:
removeAll
in interfaceList<T extends StoredObject>
-
removeIf
- Specified by:
removeIf
in interfaceCollection<T extends StoredObject>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<T extends StoredObject>
- Specified by:
retainAll
in interfaceList<T extends StoredObject>
-
clear
public void clear()Description copied from interface:ObjectLoader
Clear - remove all entries.- Specified by:
clear
in interfaceCollection<T extends StoredObject>
- Specified by:
clear
in interfaceList<T extends StoredObject>
- Specified by:
clear
in interfaceObjectList<T extends StoredObject>
- Specified by:
clear
in interfaceObjectLoader<T extends StoredObject>
-
get
- Specified by:
get
in interfaceList<T extends StoredObject>
-
set
-
add
- Specified by:
add
in interfaceList<T extends StoredObject>
-
remove
- Specified by:
remove
in interfaceList<T extends StoredObject>
-
indexOf
- Specified by:
indexOf
in interfaceObjectList<T extends StoredObject>
-
indexOf
- Specified by:
indexOf
in interfaceList<T extends StoredObject>
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<T extends StoredObject>
-
listIterator
- Specified by:
listIterator
in interfaceList<T extends StoredObject>
-
listIterator
- Specified by:
listIterator
in interfaceList<T extends StoredObject>
-
subList
-
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>
-
sort
- Specified by:
sort
in interfaceList<T extends StoredObject>
-
order
- Specified by:
order
in interfaceFiltered<T extends StoredObject>
-
filter
-
filter
- Specified by:
filter
in interfaceFiltered<T extends StoredObject>
-
getFilter
-
getComparator
- Specified by:
getComparator
in interfaceFiltered<T extends StoredObject>
-
stream
-
streamAll
-
idStream
- Specified by:
idStream
in interfaceObjectList<T extends StoredObject>
-
idStreamAll
- Specified by:
idStreamAll
in interfaceObjectList<T extends StoredObject>
-
getCacheLevel
public int getCacheLevel()- Specified by:
getCacheLevel
in interfaceObjectList<T extends StoredObject>
-
setProcessor
- Specified by:
setProcessor
in interfaceObjectList<T extends StoredObject>
-