Added field attribute to @Query annotation.

The fields attribute allows specifying which fields of matching documents should be unmarshalled.
This commit is contained in:
Oliver Gierke
2011-03-01 21:14:17 +01:00
parent 851acca320
commit 0427abfb90
2 changed files with 14 additions and 0 deletions

View File

@@ -83,6 +83,18 @@ class MongoQueryMethod extends QueryMethod {
String query = (String) AnnotationUtils.getValue(getQueryAnnotation());
return StringUtils.hasText(query) ? query : null;
}
/**
* Returns the field specification to be used for the query.
*
* @return
*/
String getFieldSpecification() {
String value = (String) AnnotationUtils.getValue(getQueryAnnotation(), "fields");
return StringUtils.hasText(value) ? value : null;
}
/**
* Returns the {@link Query} annotation that is applied to the method or {@code null} if none available.

View File

@@ -33,4 +33,6 @@ import java.lang.annotation.Target;
public @interface Query {
String value() default "";
String fields() default "";
}