Class ApiJpaCollectionResultImpl<T>
- java.lang.Object
-
- com.totvs.tjf.api.jpa.repository.impl.ApiJpaCollectionResultImpl<T>
-
- Type Parameters:
T
- type of the data transfer object for the records found.
- All Implemented Interfaces:
com.totvs.tjf.core.api.jpa.repository.ApiJpaCollectionResult<T>
public class ApiJpaCollectionResultImpl<T> extends Object implements com.totvs.tjf.core.api.jpa.repository.ApiJpaCollectionResult<T>
Standard implementation for the record JPA collection result.- Author:
- Marcos Paulo dos Santos
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ApiJpaCollectionResultImpl<T>
from(Collection<T> result)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and no more items to be handled.static <T> ApiJpaCollectionResultImpl<T>
from(org.springframework.data.domain.Page<T> page)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and no more items to be handled.Collection<T>
getItems()
Return the collection of records found.boolean
hasNext()
Return if the query has more items.static <T> ApiJpaCollectionResultImpl<T>
of(Collection<T> result, boolean hasNext)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and if it have more items.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Return if the query has more items.- Specified by:
hasNext
in interfacecom.totvs.tjf.core.api.jpa.repository.ApiJpaCollectionResult<T>
- Returns:
true
if the query has more items to handle, otherwise,false
-
getItems
public Collection<T> getItems()
Return the collection of records found.- Specified by:
getItems
in interfacecom.totvs.tjf.core.api.jpa.repository.ApiJpaCollectionResult<T>
- Returns:
- collection of records
-
from
public static <T> ApiJpaCollectionResultImpl<T> from(org.springframework.data.domain.Page<T> page)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and no more items to be handled.- Parameters:
page
- a Spring JPA page with list of objects.- Returns:
- an instance of
ApiJpaCollectionResultImpl
-
from
public static <T> ApiJpaCollectionResultImpl<T> from(Collection<T> result)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and no more items to be handled.- Parameters:
result
- collection of records- Returns:
- an instance of
ApiJpaCollectionResultImpl
-
of
public static <T> ApiJpaCollectionResultImpl<T> of(Collection<T> result, boolean hasNext)
Create an instance ofApiJpaCollectionResultImpl
with a collection of records and if it have more items.- Parameters:
result
- collection of recordshasNext
- query has more items to handle- Returns:
- an instance of
ApiJpaCollectionResultImpl
-
-