DATACASS-459 - Adopt to changed AnnotationUtils.getValue(…) behavior.

Related ticket: SPR-15540.
This commit is contained in:
Mark Paluch
2017-06-07 16:57:24 +02:00
parent 870337d00a
commit 50fb4e53c1

View File

@@ -143,7 +143,7 @@ public class CassandraQueryMethod extends QueryMethod {
* Returns whether the method has an annotated query.
*/
public boolean hasAnnotatedQuery() {
return (getAnnotatedQuery() != null);
return findAnnotatedQuery().isPresent();
}
/**
@@ -153,8 +153,16 @@ public class CassandraQueryMethod extends QueryMethod {
* @return
*/
public String getAnnotatedQuery() {
String query = (String) AnnotationUtils.getValue(getQueryAnnotation());
return (StringUtils.hasText(query) ? query : null);
return findAnnotatedQuery().orElse(null);
}
private Optional<String> findAnnotatedQuery() {
Optional<Query> queryAnnotation = Optional.ofNullable(getQueryAnnotation());
return queryAnnotation.map(AnnotationUtils::getValue) //
.map(it -> (String) it) //
.filter(StringUtils::hasText);
}
/**