Package io.ran
Class CrudRepositoryTestDoubleBase<T,K>
java.lang.Object
io.ran.CrudRepositoryTestDoubleBase<T,K>
- All Implemented Interfaces:
CrudRepository<T,
K>
public abstract class CrudRepositoryTestDoubleBase<T,K>
extends Object
implements CrudRepository<T,K>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.ran.CrudRepository
CrudRepository.CrudUpdateResult, CrudRepository.InlineQuery<T,
Q extends CrudRepository.InlineQuery<T, Q>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GenericFactory
protected MappingHelper
protected final TestDoubleDb
protected TypeDescriber<T>
-
Constructor Summary
ConstructorsConstructorDescriptionCrudRepositoryTestDoubleBase
(GenericFactory genericFactory, Class<T> modelType, Class<K> keyType, MappingHelper mappingHelper, TestDoubleDb store) -
Method Summary
Modifier and TypeMethodDescriptiondeleteById
(K k) Delete an instance of the entity by its id (primary key).deleteByIds
(Collection<K> k) Delete all instances of the entity which has an id (primary key) in the given collection.Get an instance of the entity by its id (primary key).getAll()
Get all instances of the entity, as a stream.Insert a new instance of the entity or update an existing one.protected <Z> CrudRepository.CrudUpdateResult
-
Field Details
-
store
-
genericFactory
-
modelType
-
keyType
-
typeDescriber
-
mappingHelper
-
-
Constructor Details
-
CrudRepositoryTestDoubleBase
public CrudRepositoryTestDoubleBase(GenericFactory genericFactory, Class<T> modelType, Class<K> keyType, MappingHelper mappingHelper, TestDoubleDb store)
-
-
Method Details
-
get
Description copied from interface:CrudRepository
Get an instance of the entity by its id (primary key).Note: If the entity does not have a primary key, this method will not be available.
In case of compound primary key, pass the model object with the primary key fields populated.
- Specified by:
get
in interfaceCrudRepository<T,
K> - Parameters:
k
- the id of the entity- Returns:
- an optional containing the entity if it exists
-
getAll
Description copied from interface:CrudRepository
Get all instances of the entity, as a stream.- Specified by:
getAll
in interfaceCrudRepository<T,
K> - Returns:
- an unordered stream of all instances of the entity
-
deleteById
Description copied from interface:CrudRepository
Delete an instance of the entity by its id (primary key).Note: If the entity does not have a primary key, this method will not be available.
In case of compound primary key, pass the model object with the primary key fields populated.
- Specified by:
deleteById
in interfaceCrudRepository<T,
K> - Parameters:
k
- the id of the entity to be deleted- Returns:
- the result of the delete operation
-
deleteByIds
Description copied from interface:CrudRepository
Delete all instances of the entity which has an id (primary key) in the given collection.Note: If the entity does not have a primary key, this method will not be available.
In case of compound primary key, pass the model object with the primary key fields populated.
- Specified by:
deleteByIds
in interfaceCrudRepository<T,
K> - Parameters:
k
- a collection of ids to be deleted- Returns:
- the result of the delete operation
-
save
Description copied from interface:CrudRepository
Insert a new instance of the entity or update an existing one. Will match by primary key, but not other unique keys.- Specified by:
save
in interfaceCrudRepository<T,
K> - Parameters:
t
- the entity to save- Returns:
- the result of the save operation
-
save
-