br.com.anteros.nosql.persistence.mongodb.query.Projection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-NoSql-Persistence-MongoDB Show documentation
Show all versions of Anteros-NoSql-Persistence-MongoDB Show documentation
Anteros NoSQL Persistence MongoDB.
package br.com.anteros.nosql.persistence.mongodb.query;
import com.mongodb.BasicDBObject;
public class Projection {
public static ProjectionBuilder include(String... fields) {
return new ProjectionBuilder().include(fields);
}
public static ProjectionBuilder exclude(String... fields) {
return new ProjectionBuilder().exclude(fields);
}
public static class ProjectionBuilder extends BasicDBObject {
private ProjectionBuilder() {
}
public ProjectionBuilder include(String... fields) {
for (String field : fields) {
put(field, 1);
}
return this;
}
public ProjectionBuilder exclude(String... fields) {
for (String field : fields) {
put(field, 0);
}
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy