diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/QueryMethod.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/QueryMethod.java index f915b56a7..85616cf02 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/QueryMethod.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/query/QueryMethod.java @@ -120,6 +120,11 @@ public class QueryMethod { return String.format("%s.%s", domainClass.getSimpleName(), method.getName()); } + /** + * Returns the domain class the query method is targeted at. + * + * @return + */ protected Class getDomainClass() { Class repositoryDomainClass = metadata.getDomainClass(); @@ -128,6 +133,15 @@ public class QueryMethod { return repositoryDomainClass == null || repositoryDomainClass.isAssignableFrom(methodDomainClass) ? methodDomainClass : repositoryDomainClass; } + + /** + * Returns the type of the object that will be returned. + * + * @return + */ + public Class getReturnedObjectType() { + return metadata.getReturnedDomainClass(method); + } /** * Returns whether the finder will actually return a collection of entities or a single one.