Class FilteredEntityList
java.lang.Object
ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
ch.tocco.nice2.persist.core.api.entity.AbstractEntityListWrapper
ch.tocco.nice2.persist.core.api.util.FilteredEntityList
- All Implemented Interfaces:
EntityList
,Iterable<Entity>
A wrapper over an
EntityList
to possibly filter out entries.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
AbstractEntityList.SimpleIterator
Nested classes/interfaces inherited from interface ch.tocco.nice2.persist.core.api.entity.EntityList
EntityList.Filter
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityListWrapper
entityList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(int index, boolean eager) Get the entity at the specified index.@Nullable Entity
get
(PrimaryKey key, boolean eager) Get the entity with the specified key in that list.getKey
(int index) Returns the PrimaryKey at the specified position.getKeys()
Read in subclasses if this array can contain null values or not.int
indexOf
(PrimaryKey key) Get the index within the list of the entity with the specified key.int
size()
Get the number of entities this list contains.Methods inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityListWrapper
getManager, getModel, getPageCount, getPageSize, setPageSize, unwrap
Methods inherited from class ch.tocco.nice2.persist.core.api.entity.AbstractEntityList
contains, expect, expectAtLeast, expectAtMost, get, get, isEmpty, iterator, toList, toList
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.entity.EntityList
doWithSingleResult, doWithSingleResultOr, expectAtMostOrThrow, expectOr, expectOrThrow, getFirstEntity, getOnlyResult, getOptionalOnlyResult, getOptionalOnlyResult, requireFirstEntity, spliterator, stream
-
Constructor Details
-
FilteredEntityList
- Throws:
PersistException
- See Also:
-
-
Method Details
-
size
public int size()Description copied from interface:EntityList
Get the number of entities this list contains.- Specified by:
size
in interfaceEntityList
- Overrides:
size
in classAbstractEntityListWrapper
- Returns:
- The number of entities.
-
getKeys
Description copied from interface:EntityList
Read in subclasses if this array can contain null values or not.- Specified by:
getKeys
in interfaceEntityList
- Overrides:
getKeys
in classAbstractEntityListWrapper
- Returns:
- A defensive copy of the array. The size matches the
EntityList.size()
method.
-
get
Description copied from interface:EntityList
Get the entity at the specified index.- Specified by:
get
in interfaceEntityList
- Overrides:
get
in classAbstractEntityListWrapper
- Parameters:
index
- The index.eager
-true
, if a page should be eagerly loaded, if the entity's state ishollow
, false otherwise.- Returns:
- The entity at the specified index potentially in
unusable state
, ornull
. - Throws:
PersistException
ArrayIndexOutOfBoundsException
-
get
Description copied from interface:EntityList
Get the entity with the specified key in that list.- Specified by:
get
in interfaceEntityList
- Overrides:
get
in classAbstractEntityList
- Parameters:
key
- The key of the entity.eager
-true
, if a page should be eagerly loaded, if the entity's state ishollow
, false otherwise.- Returns:
- The entity with the specified key potentially in
unusable state
, ornull
. - Throws:
PersistException
-
getKey
Description copied from interface:EntityList
Returns the PrimaryKey at the specified position.- Specified by:
getKey
in interfaceEntityList
- Overrides:
getKey
in classAbstractEntityListWrapper
-
indexOf
Description copied from interface:EntityList
Get the index within the list of the entity with the specified key.- Specified by:
indexOf
in interfaceEntityList
- Overrides:
indexOf
in classAbstractEntityListWrapper
- Parameters:
key
- The primary key.- Returns:
- The index or -1, if there's no such entity in the list.
-