Class RepositoryInformationSupport
java.lang.Object
org.springframework.data.repository.core.RepositoryInformationSupport
- All Implemented Interfaces:
RepositoryInformation
,RepositoryMetadata
Common base class for
RepositoryInformation
that delays resolution of RepositoryMetadata
and the
repository base to the latest possible time.- Since:
- 3.0
- Author:
- Christoph Strobl
-
Constructor Summary
ConstructorDescriptionRepositoryInformationSupport
(Supplier<RepositoryMetadata> metadata, Supplier<Class<?>> repositoryBaseClass) -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of types the repository shall be discoverable for when trying to look up a repository by domain type.ReturnsCrudMethods
meta information for the repository.Class<?>
Returns the raw domain class the repository is declared for.Returns theTypeInformation
of the domain type the repository is declared to manage.Class<?>
Returns the raw id class the given class is declared for.Returns theTypeInformation
of the id type of the repository.Returns all methods considered to be query methods.Class<?>
Returns the base class to be used to create the proxy backing instance.Class<?>
Returns the repository interface.Class<?>
getReturnedDomainClass
(Method method) Returns the domain class returned by the givenMethod
.getReturnType
(Method method) Returns the typeMethod
return type as it is declared in the repository.boolean
Returns if the configured repository interface has custom methods, that might have to be delegated to a custom implementation.boolean
Returns whether the repository is a paging one.protected boolean
isQueryAnnotationPresentOn
(Method method) Checks whether the given method contains a custom store specific query annotation annotated withQueryAnnotation
.boolean
isQueryMethod
(Method method) Returns whether the given method is a query method.protected boolean
isQueryMethodCandidate
(Method method) Checks whether the given method is a query method candidate.boolean
Returns whether the repository is a reactive one, i.e. if it uses reactive types in one of its methods.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.repository.core.RepositoryInformation
getTargetClassMethod, hasQueryMethods, isBaseClassMethod, isCustomMethod
Methods inherited from interface org.springframework.data.repository.core.RepositoryMetadata
getFragments
-
Constructor Details
-
RepositoryInformationSupport
public RepositoryInformationSupport(Supplier<RepositoryMetadata> metadata, Supplier<Class<?>> repositoryBaseClass)
-
-
Method Details
-
getQueryMethods
Description copied from interface:RepositoryInformation
Returns all methods considered to be query methods.- Specified by:
getQueryMethods
in interfaceRepositoryInformation
- Returns:
-
getIdType
Description copied from interface:RepositoryMetadata
Returns the raw id class the given class is declared for.- Specified by:
getIdType
in interfaceRepositoryMetadata
- Returns:
- the raw id class of the entity managed by the repository.
-
getDomainType
Description copied from interface:RepositoryMetadata
Returns the raw domain class the repository is declared for.- Specified by:
getDomainType
in interfaceRepositoryMetadata
- Returns:
- the raw domain class the repository is handling.
-
getRepositoryInterface
Description copied from interface:RepositoryMetadata
Returns the repository interface.- Specified by:
getRepositoryInterface
in interfaceRepositoryMetadata
- Returns:
-
getReturnType
Description copied from interface:RepositoryMetadata
Returns the typeMethod
return type as it is declared in the repository. Considers suspended methods and does not unwrap component types but leaves those for further inspection.- Specified by:
getReturnType
in interfaceRepositoryMetadata
- Returns:
-
getReturnedDomainClass
Description copied from interface:RepositoryMetadata
Returns the domain class returned by the givenMethod
. In contrast toRepositoryMetadata.getReturnType(Method)
, this method extracts the type fromCollection
s andPage
as well.- Specified by:
getReturnedDomainClass
in interfaceRepositoryMetadata
- Returns:
- See Also:
-
getCrudMethods
Description copied from interface:RepositoryMetadata
ReturnsCrudMethods
meta information for the repository.- Specified by:
getCrudMethods
in interfaceRepositoryMetadata
- Returns:
-
isPagingRepository
public boolean isPagingRepository()Description copied from interface:RepositoryMetadata
Returns whether the repository is a paging one.- Specified by:
isPagingRepository
in interfaceRepositoryMetadata
- Returns:
-
getAlternativeDomainTypes
Description copied from interface:RepositoryMetadata
Returns the set of types the repository shall be discoverable for when trying to look up a repository by domain type.- Specified by:
getAlternativeDomainTypes
in interfaceRepositoryMetadata
- Returns:
- the set of types the repository shall be discoverable for when trying to look up a repository by domain type, must not be null.
- See Also:
-
isReactiveRepository
public boolean isReactiveRepository()Description copied from interface:RepositoryMetadata
Returns whether the repository is a reactive one, i.e. if it uses reactive types in one of its methods.- Specified by:
isReactiveRepository
in interfaceRepositoryMetadata
- Returns:
-
getRepositoryBaseClass
Description copied from interface:RepositoryInformation
Returns the base class to be used to create the proxy backing instance.- Specified by:
getRepositoryBaseClass
in interfaceRepositoryInformation
- Returns:
-
isQueryMethod
Description copied from interface:RepositoryInformation
Returns whether the given method is a query method.- Specified by:
isQueryMethod
in interfaceRepositoryInformation
- Returns:
-
getDomainTypeInformation
Description copied from interface:RepositoryMetadata
Returns theTypeInformation
of the domain type the repository is declared to manage. Will never be null.- Specified by:
getDomainTypeInformation
in interfaceRepositoryMetadata
- Returns:
- the domain class the repository is handling.
-
getIdTypeInformation
Description copied from interface:RepositoryMetadata
Returns theTypeInformation
of the id type of the repository.- Specified by:
getIdTypeInformation
in interfaceRepositoryMetadata
- Returns:
- the
TypeInformation
class of the identifier of the entity managed by the repository. Will never be null.
-
hasCustomMethod
public boolean hasCustomMethod()Description copied from interface:RepositoryInformation
Returns if the configured repository interface has custom methods, that might have to be delegated to a custom implementation. This is used to verify repository configuration.- Specified by:
hasCustomMethod
in interfaceRepositoryInformation
- Returns:
-
isQueryAnnotationPresentOn
Checks whether the given method contains a custom store specific query annotation annotated withQueryAnnotation
. The method-hierarchy is also considered in the search for the annotation.- Parameters:
method
-- Returns:
-
isQueryMethodCandidate
Checks whether the given method is a query method candidate.- Parameters:
method
-- Returns:
-