-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider supporting interface-based, class-based and dynamic projecti…
…ons for result mapping of query methods Closes gh-26
- Loading branch information
1 parent
c22b4cf
commit 2bbd24d
Showing
7 changed files
with
472 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ingframework/data/reindexer/repository/support/ReindexerAnnotationRepositoryMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2022 evgeniycheban | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.data.reindexer.repository.support; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import org.springframework.data.reindexer.repository.util.ReindexerQueryExecutionConverters; | ||
import org.springframework.data.repository.core.support.AnnotationRepositoryMetadata; | ||
import org.springframework.data.repository.util.ReactiveWrapperConverters; | ||
import org.springframework.data.util.TypeInformation; | ||
|
||
/** | ||
* {@link org.springframework.data.repository.core.RepositoryMetadata} implementation inspecting the given | ||
* repository interface for a {@link org.springframework.data.repository.RepositoryDefinition} annotation. | ||
* | ||
* @author Evgeniy Cheban | ||
*/ | ||
public class ReindexerAnnotationRepositoryMetadata extends AnnotationRepositoryMetadata { | ||
|
||
/** | ||
* Creates a new {@link ReindexerAnnotationRepositoryMetadata} instance looking up repository types from a | ||
* {@link org.springframework.data.repository.RepositoryDefinition} annotation. | ||
* | ||
* @param repositoryInterface must not be {@literal null}. | ||
*/ | ||
public ReindexerAnnotationRepositoryMetadata(Class<?> repositoryInterface) { | ||
super(repositoryInterface); | ||
} | ||
|
||
@Override | ||
public Class<?> getReturnedDomainClass(Method method) { | ||
TypeInformation<?> returnType = getReturnType(method); | ||
returnType = ReactiveWrapperConverters.unwrapWrapperTypes(returnType); | ||
return ReindexerQueryExecutionConverters.unwrapWrapperTypes(returnType, getDomainTypeInformation()).getType(); | ||
} | ||
|
||
} |
Oops, something went wrong.