T
- the type of things to storeID
- a "primary key" to the thingspublic abstract class AbstractInMemoryRepository<T,ID extends java.io.Serializable & java.lang.Comparable<ID>> extends AbstractRepository<T,ID> implements org.springframework.data.repository.PagingAndSortingRepository<T,ID>, RangeCapableRepository<T,ID>
Map
internally.
Default behaviour is to retain sort order on the keys. Hence, this is by default the only sort supported when
querying with a Pageable
.Modifier | Constructor and Description |
---|---|
protected |
AbstractInMemoryRepository() |
Modifier and Type | Method and Description |
---|---|
protected java.util.NavigableMap<ID,T> |
buildMap() |
long |
count() |
void |
delete(ID id) |
void |
delete(T entity) |
void |
deleteAll() |
java.lang.Iterable<T> |
findAll() |
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.domain.Pageable pageable) |
java.lang.Iterable<T> |
findAll(org.springframework.data.domain.Sort sort) |
java.lang.Iterable<T> |
findAllInRange(ID from,
boolean fromInclusive,
ID to,
boolean toInclusive)
Return entities whose ids range between
from and to . |
T |
findOne(ID id) |
protected abstract ID |
keyFor(T entity) |
<S extends T> |
save(S entity) |
protected org.springframework.data.domain.Page<T> |
slice(java.util.List<T> list,
org.springframework.data.domain.Pageable pageable)
Post-process the list to only return elements matching the page request.
|
delete, exists, findAll, save
public <S extends T> S save(S entity)
public java.lang.Iterable<T> findAll()
public long count()
public void delete(ID id)
public void delete(T entity)
public void deleteAll()
public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
protected org.springframework.data.domain.Page<T> slice(java.util.List<T> list, org.springframework.data.domain.Pageable pageable)
public java.lang.Iterable<T> findAll(org.springframework.data.domain.Sort sort)
public java.lang.Iterable<T> findAllInRange(ID from, boolean fromInclusive, ID to, boolean toInclusive)
RangeCapableRepository
from
and to
. Note that it is possible that entities with
those exact ids do not exist. If they do exist, the two boolean parameters control whether to include those
results or not. A query from x
to x
returns an empty result, unless both fromInclusive
and toInclusive
are true.findAllInRange
in interface RangeCapableRepository<T,ID extends java.io.Serializable & java.lang.Comparable<ID>>