Module spring.data.commons
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
ConstructorsConstructorDescriptionDefaultCrudMethods(RepositoryMetadata metadata) Creates a newDefaultCrudMethodsusing 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.booleanReturns whether the repository exposes a delete method.booleanReturns whether the repository exposes a find all method at all.booleanReturns whether the repository exposes a find one method.booleanReturns whether the repository exposes a save method at all.
-
Constructor Details
-
DefaultCrudMethods
Creates a newDefaultCrudMethodsusing the givenRepositoryMetadata.- Parameters:
metadata- must not be null.
-
-
Method Details
-
getSaveMethod
Description copied from interface:CrudMethodsReturns the method to be used for saving entities. Usually signature compatible toCrudRepository.save(Object).- Specified by:
getSaveMethodin interfaceCrudMethods- Returns:
- the method to save entities or
Optional.empty()if none exposed. - See Also:
-
hasSaveMethod
public boolean hasSaveMethod()Description copied from interface:CrudMethodsReturns whether the repository exposes a save method at all.- Specified by:
hasSaveMethodin interfaceCrudMethods- Returns:
-
getFindAllMethod
Description copied from interface:CrudMethodsReturns the find all method of the repository. Implementations should prefer more detailed methods likePagingAndSortingRepository's taking aPageableorSortinstance.- Specified by:
getFindAllMethodin 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:CrudMethodsReturns whether the repository exposes a find all method at all.- Specified by:
hasFindAllMethodin interfaceCrudMethods- Returns:
-
getFindOneMethod
Description copied from interface:CrudMethodsReturns the find one method of the repository. Usually signature compatible toCrudRepository.findById(Object)- Specified by:
getFindOneMethodin 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:CrudMethodsReturns whether the repository exposes a find one method.- Specified by:
hasFindOneMethodin interfaceCrudMethods- Returns:
-
hasDelete
public boolean hasDelete()Description copied from interface:CrudMethodsReturns whether the repository exposes a delete method.- Specified by:
hasDeletein interfaceCrudMethods- Returns:
-
getDeleteMethod
Description copied from interface:CrudMethodsReturns the delete method of the repository. Will prefer a delete-by-entity method over a delete-by-id method.- Specified by:
getDeleteMethodin interfaceCrudMethods- Returns:
- the delete method of the repository or
Optional.empty()if not available. - See Also:
-