Package de.hybris.platform.core
Class LazyLoadItemList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
de.hybris.platform.core.internal.BaseLazyLoadItemList<E>
de.hybris.platform.core.LazyLoadItemList<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,List<E>
- Direct Known Subclasses:
AbstractLazyLoadValueList,LazyLoadItemListInternalTest.TestPKLazyLoadItemList,LazyLoadModelList,MonitoredLazyLoadItemList
Class to store PKs instead of Items. These items are lazy loaded when the list elements are read.
List is thread safe for accessing it elements via get(int).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classThread safe (hopefully) abstraction for paged result objects list with information at which index this page starts. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe value forDEFAULT_PREFETCH_SIZEis read from the configuration properties.static final intDeprecated, for removal: This API element is subject to removal in a future version.since agesstatic final LazyLoadItemListStatic, light-weight empty list instance.static final StringFields inherited from class de.hybris.platform.core.internal.BaseLazyLoadItemList
DEFAULT_CONFIG_PREFETCH_SIZEFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionThis constructor usees as prefetch sizeDEFAULT_PREFETCH_SIZE.LazyLoadItemList(Set<PK> prefetchLanguages, List<PK> pks, int prefetchSize) LazyLoadItemList Constructor.protectedLazyLoadItemList(Set<PK> prefetchLanguages, List<PK> pks, int prefetchSize, boolean modifable) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclear()get(int index) protected EgetBuffered(int listPos) Gets an object of type E for absolute global givenlistPos.protected LazyLoadItemList.BufferedPage<E>getBufferedPageIfLoaded(int totalIndex) Returns aLazyLoadItemList.BufferedPagefor the giventotalIndexor null if it is not in range ofcurrentBufferedPage.protected LazyLoadItemList.BufferedPage<E>protected LazyLoadItemList.BufferedPage<E>getOrSwitchBufferedPage(int totalIndex) Returns aLazyLoadItemList.BufferedPagefor the giventotalIndexor creates a newLazyLoadItemList.BufferedPageif it is not in range ofcurrentBufferedPage.protected voidInvalidates acurrentBufferedPage's .booleanDeprecated, for removal: This API element is subject to removal in a future version.since 4.8Override this method to provide a resolving mechanism for generating values for the pre-fetchedBaseLazyLoadItemList.pkListentries.remove(int index) Does not completely fulfill the remove() contract.Does not completely fulfill the set() contract.voidsetIgnoreMissing(boolean ignoreMissing) Deprecated, for removal: This API element is subject to removal in a future version.since 4.8voidsetModifiable(boolean modifiable) Deprecated, for removal: This API element is subject to removal in a future version.since 4.8 set modifiable during creation - by default is truevoidsetPreFetchSize(int preFetchSize) Deprecated, for removal: This API element is subject to removal in a future version.since 4.8 does not have a counter part - set a prefetch size in constructorprotected LazyLoadItemList.BufferedPage<E>switchBufferedPage(int totalIndex) protected final LazyLoadItemList.BufferedPage<E>switchBufferedPageNoLock(int totalIndex) protected final LazyLoadItemList.BufferedPage<E>switchBufferedPageSynchronized(int totalIndex) protected LazyLoadItemList.BufferedPage<E>switchPage(int listPos) Not thread safe switch page method.Methods inherited from class de.hybris.platform.core.internal.BaseLazyLoadItemList
assureIndex, contains, equals, getConfig, getPK, getPKList, getPKListInternal, getPrefetchLanguages, getPreFetchSize, hashCode, isModifiable, iterator, size, toStringMethods inherited from class java.util.AbstractList
add, addAll, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
PREFETCH_SIZE_PROPERTY
- See Also:
-
DEFAULT_PREFETCH_SIZE
public static final int DEFAULT_PREFETCH_SIZEThe value forDEFAULT_PREFETCH_SIZEis read from the configuration properties. The key islazy.pkcollection.prefetchsize.- See Also:
-
EMPTY_LIST
Static, light-weight empty list instance. Should be used where an empty list stub is needed. -
DEFUALT_PREFETCH_SIZE
Deprecated, for removal: This API element is subject to removal in a future version.since agesdeprecated, use DEFAULT_PREFETCH_SIZE instead (without typo)- See Also:
-
-
Constructor Details
-
LazyLoadItemList
public LazyLoadItemList()This constructor usees as prefetch sizeDEFAULT_PREFETCH_SIZE. -
LazyLoadItemList
LazyLoadItemList Constructor.- Parameters:
prefetchLanguages-pks-prefetchSize- use postive values only orDEFAULT_PREFETCH_SIZEfor reading the value from the configuration properties.
-
LazyLoadItemList
-
-
Method Details
-
get
- Specified by:
getin interfaceList<E>- Specified by:
getin classBaseLazyLoadItemList<E>- Throws:
IndexOutOfBoundsException
-
getBuffered
Gets an object of type E for absolute global givenlistPos. Internally it checks if this index is accessible for the current page if not appropriate page is loaded.Method ensured by change of volatile
currentBufferedPageto retrieve consistent result for given index in multi-threaded environment. -
invalidateBuffer
protected void invalidateBuffer()Invalidates acurrentBufferedPage's . -
switchPage
Not thread safe switch page method. -
loadPage
Override this method to provide a resolving mechanism for generating values for the pre-fetchedBaseLazyLoadItemList.pkListentries. -
set
Does not completely fulfill the set() contract. To make sure this method does not instantiate the item at the given index, always null is returned. -
add
-
remove
Does not completely fulfill the remove() contract. To make sure this method does not instantiate the item at the given index, always null is returned. -
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classBaseLazyLoadItemList<E>
-
setPreFetchSize
Deprecated, for removal: This API element is subject to removal in a future version.since 4.8 does not have a counter part - set a prefetch size in constructorIf you wish to use the prefetch value from the configuration properties, preferDEFAULT_PREFETCH_SIZEinstead of -1. Other negative values are interpreted as -1. If you add a negative or invalid value to the configuration property keylazy.pkcollection.prefetchsize, the prefetch size is set to 100. If you do not wish to use the value from the configuration properties, use positive values only.- Parameters:
preFetchSize- the size of the prefetched elements for the list. Has to be a positive value.
-
isIgnoreMissing
Deprecated, for removal: This API element is subject to removal in a future version.since 4.8- Returns:
- the ignoreMissing
-
setIgnoreMissing
Deprecated, for removal: This API element is subject to removal in a future version.since 4.8- Parameters:
ignoreMissing- the ignoreMissing to set
-
setModifiable
Deprecated, for removal: This API element is subject to removal in a future version.since 4.8 set modifiable during creation - by default is true- Parameters:
modifiable- the modifiable to set
-
getCurrentBufferedPage
-
getOrSwitchBufferedPage
Returns aLazyLoadItemList.BufferedPagefor the giventotalIndexor creates a newLazyLoadItemList.BufferedPageif it is not in range ofcurrentBufferedPage. -
getBufferedPageIfLoaded
Returns aLazyLoadItemList.BufferedPagefor the giventotalIndexor null if it is not in range ofcurrentBufferedPage. -
switchBufferedPage
-
switchBufferedPageSynchronized
-
switchBufferedPageNoLock
-