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. * 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);
} }
/** /**