org.neogroup.warp.data.query.traits.HasGroupByFields Maven / Gradle / Ivy
package org.neogroup.warp.data.query.traits;
import org.neogroup.warp.data.query.fields.Field;
import java.util.Collections;
import java.util.List;
public interface HasGroupByFields {
List getGroupByFields();
R setGroupByFields (List groupByFields);
default R groupBy(String... fields) {
List groupByFields = getGroupByFields();
for (String field : fields) {
groupByFields.add(new Field(field));
}
return (R)this;
}
default R groupBy(Field... groupByFields) {
Collections.addAll(getGroupByFields(), groupByFields);
return (R)this;
}
default R clearGroupByFields() {
getGroupByFields().clear();
return (R)this;
}
}