Browse Source

Polishing.

Use Method reference for in-/exclusion update javadoc since tags.

Original Pull Request: #4668
pull/4791/head
Christoph Strobl 2 years ago
parent
commit
541c43b284
No known key found for this signature in database
GPG Key ID: E6054036D0C37A4B
  1. 14
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Field.java

14
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Field.java

@ -125,7 +125,6 @@ public class Field {
* @since 3.1 * @since 3.1
*/ */
public Field include(String... fields) { public Field include(String... fields) {
return include(Arrays.asList(fields)); return include(Arrays.asList(fields));
} }
@ -134,15 +133,13 @@ public class Field {
* *
* @param fields the document field names to be included. * @param fields the document field names to be included.
* @return {@code this} field projection instance. * @return {@code this} field projection instance.
* @since 4.4
*/ */
public Field include(Collection<String> fields) { public Field include(Collection<String> fields) {
Assert.notNull(fields, "Keys must not be null"); Assert.notNull(fields, "Keys must not be null");
for (String key : fields) { fields.forEach(this::include);
criteria.put(key, 1);
}
return this; return this;
} }
@ -169,7 +166,6 @@ public class Field {
* @since 3.1 * @since 3.1
*/ */
public Field exclude(String... fields) { public Field exclude(String... fields) {
return exclude(Arrays.asList(fields)); return exclude(Arrays.asList(fields));
} }
@ -178,15 +174,13 @@ public class Field {
* *
* @param fields the document field names to be excluded. * @param fields the document field names to be excluded.
* @return {@code this} field projection instance. * @return {@code this} field projection instance.
* @since 4.4
*/ */
public Field exclude(Collection<String> fields) { public Field exclude(Collection<String> fields) {
Assert.notNull(fields, "Keys must not be null"); Assert.notNull(fields, "Keys must not be null");
for (String key : fields) { fields.forEach(this::exclude);
criteria.put(key, 0);
}
return this; return this;
} }

Loading…
Cancel
Save