Class QueryMethod
java.lang.Object
org.springframework.data.repository.query.QueryMethod
Abstraction of a method that is designated to execute a finder query. Enriches the standard
Method
interface
with specific information that is necessary to construct RepositoryQuery
s for the method.- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Maciek Opała, Mark Paluch, Johannes Englmeier
-
Constructor Summary
ConstructorDescriptionQueryMethod
(Method method, RepositoryMetadata metadata, ProjectionFactory factory) Creates a newQueryMethod
from the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected Parameters<?,
?> createParameters
(Method method) Deprecated, for removal: This API element is subject to removal in a future version.protected Parameters<?,
?> createParameters
(Method method, TypeInformation<?> domainType) Creates aParameters
instance.protected Class<?>
Returns the domain class the query method is targeted at.getName()
Returns the method's name.Returns the name of the named query this method belongs to.Parameters<?,
?> Returns theParameters
wrapper to gain additional information aboutMethod
parameters.Returns theResultProcessor
to be used with the query method.Class<?>
Returns the type of the object that will be returned.boolean
Returns whether the finder will actually return a collection of entities or a single one.boolean
Returns whether the query method is a modifying one.final boolean
Returns whether the finder will return aPage
of results.boolean
Returns whether the query for this method actually returns entities.boolean
Returns whether the query method will return aWindow
.boolean
Returns whether the query method will return aSlice
.boolean
Returns whether the method returns a Stream.toString()
-
Constructor Details
-
QueryMethod
Creates a newQueryMethod
from the given parameters. Looks up the correct query to use for following invocations of the method given.- Parameters:
method
- must not be null.metadata
- must not be null.factory
- must not be null.
-
-
Method Details
-
createParameters
Deprecated, for removal: This API element is subject to removal in a future version.since 3.1, call or overridecreateParameters(Method, TypeInformation)
instead.Creates aParameters
instance.- Parameters:
method
- must not be null.- Returns:
- must not return null.
-
createParameters
Creates aParameters
instance.- Parameters:
method
- must not be null.domainType
- must not be null.- Returns:
- must not return null.
- Since:
- 3.0.2
-
getName
Returns the method's name.- Returns:
-
getEntityInformation
-
getNamedQueryName
Returns the name of the named query this method belongs to.- Returns:
-
getDomainClass
Returns the domain class the query method is targeted at.- Returns:
- will never be null.
-
getReturnedObjectType
Returns the type of the object that will be returned.- Returns:
-
isCollectionQuery
public boolean isCollectionQuery()Returns whether the finder will actually return a collection of entities or a single one.- Returns:
-
isScrollQuery
public boolean isScrollQuery()Returns whether the query method will return aWindow
.- Returns:
- Since:
- 3.1
-
isSliceQuery
public boolean isSliceQuery()Returns whether the query method will return aSlice
.- Returns:
- Since:
- 1.8
-
isPageQuery
public final boolean isPageQuery()Returns whether the finder will return aPage
of results.- Returns:
-
isModifyingQuery
public boolean isModifyingQuery()Returns whether the query method is a modifying one.- Returns:
-
isQueryForEntity
public boolean isQueryForEntity()Returns whether the query for this method actually returns entities.- Returns:
-
isStreamQuery
public boolean isStreamQuery()Returns whether the method returns a Stream.- Returns:
- Since:
- 1.10
-
getParameters
Returns theParameters
wrapper to gain additional information aboutMethod
parameters.- Returns:
-
getResultProcessor
Returns theResultProcessor
to be used with the query method.- Returns:
- the resultFactory
-
toString
-
createParameters(Method, TypeInformation)
instead.