Class DefaultCrudMethods
java.lang.Object
org.springframework.data.repository.core.support.DefaultCrudMethods
- All Implemented Interfaces:
CrudMethods
Default implementation to discover CRUD methods based on the given
RepositoryMetadata
. Will detect methods
exposed in CrudRepository
but also hand crafted CRUD methods that are signature compatible with the ones on
CrudRepository
.- Since:
- 1.6
- Author:
- Oliver Gierke, Thomas Darimont
-
Constructor Summary
ConstructorDescriptionDefaultCrudMethods
(RepositoryMetadata metadata) Creates a newDefaultCrudMethods
using the givenRepositoryMetadata
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the delete method of the repository.Returns the find all method of the repository.Returns the find one method of the repository.Returns the method to be used for saving entities.boolean
Returns whether the repository exposes a delete method.boolean
Returns whether the repository exposes a find all method at all.boolean
Returns whether the repository exposes a find one method.boolean
Returns whether the repository exposes a save method at all.
-
Constructor Details
-
DefaultCrudMethods
Creates a newDefaultCrudMethods
using the givenRepositoryMetadata
.- Parameters:
metadata
- must not be null.
-
-
Method Details
-
getSaveMethod
Description copied from interface:CrudMethods
Returns the method to be used for saving entities. Usually signature compatible toCrudRepository.save(Object)
.- Specified by:
getSaveMethod
in interfaceCrudMethods
- Returns:
- the method to save entities or
Optional.empty()
if none exposed. - See Also:
-
hasSaveMethod
public boolean hasSaveMethod()Description copied from interface:CrudMethods
Returns whether the repository exposes a save method at all.- Specified by:
hasSaveMethod
in interfaceCrudMethods
- Returns:
-
getFindAllMethod
Description copied from interface:CrudMethods
Returns the find all method of the repository. Implementations should prefer more detailed methods likePagingAndSortingRepository
's taking aPageable
orSort
instance.- Specified by:
getFindAllMethod
in interfaceCrudMethods
- Returns:
- the find all method of the repository or
Optional.empty()
if not available. - See Also:
-
hasFindAllMethod
public boolean hasFindAllMethod()Description copied from interface:CrudMethods
Returns whether the repository exposes a find all method at all.- Specified by:
hasFindAllMethod
in interfaceCrudMethods
- Returns:
-
getFindOneMethod
Description copied from interface:CrudMethods
Returns the find one method of the repository. Usually signature compatible toCrudRepository.findById(Object)
- Specified by:
getFindOneMethod
in interfaceCrudMethods
- Returns:
- the find one method of the repository or
Optional.empty()
if not available. - See Also:
-
hasFindOneMethod
public boolean hasFindOneMethod()Description copied from interface:CrudMethods
Returns whether the repository exposes a find one method.- Specified by:
hasFindOneMethod
in interfaceCrudMethods
- Returns:
-
hasDelete
public boolean hasDelete()Description copied from interface:CrudMethods
Returns whether the repository exposes a delete method.- Specified by:
hasDelete
in interfaceCrudMethods
- Returns:
-
getDeleteMethod
Description copied from interface:CrudMethods
Returns the delete method of the repository. Will prefer a delete-by-entity method over a delete-by-id method.- Specified by:
getDeleteMethod
in interfaceCrudMethods
- Returns:
- the delete method of the repository or
Optional.empty()
if not available. - See Also:
-