DATACASS-459 - Adopt to changed AnnotationUtils.getValue(…) behavior.
Related ticket: SPR-15540.
This commit is contained in:
@@ -143,7 +143,7 @@ public class CassandraQueryMethod extends QueryMethod {
|
|||||||
* Returns whether the method has an annotated query.
|
* Returns whether the method has an annotated query.
|
||||||
*/
|
*/
|
||||||
public boolean hasAnnotatedQuery() {
|
public boolean hasAnnotatedQuery() {
|
||||||
return (getAnnotatedQuery() != null);
|
return findAnnotatedQuery().isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,8 +153,16 @@ public class CassandraQueryMethod extends QueryMethod {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getAnnotatedQuery() {
|
public String getAnnotatedQuery() {
|
||||||
String query = (String) AnnotationUtils.getValue(getQueryAnnotation());
|
return findAnnotatedQuery().orElse(null);
|
||||||
return (StringUtils.hasText(query) ? query : null);
|
}
|
||||||
|
|
||||||
|
private Optional<String> findAnnotatedQuery() {
|
||||||
|
|
||||||
|
Optional<Query> queryAnnotation = Optional.ofNullable(getQueryAnnotation());
|
||||||
|
|
||||||
|
return queryAnnotation.map(AnnotationUtils::getValue) //
|
||||||
|
.map(it -> (String) it) //
|
||||||
|
.filter(StringUtils::hasText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user