All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dream.flex.def.GroupByDef Maven / Gradle / Ivy

The newest version!
package com.dream.flex.def;

import com.dream.antlr.smt.GroupStatement;
import com.dream.antlr.smt.ListColumnStatement;
import com.dream.antlr.smt.Statement;

import java.util.Arrays;

public interface GroupByDef<
        Having extends HavingDef,
        OrderBy extends OrderByDef,
        Limit extends LimitDef,
        Union extends UnionDef,
        ForUpdate extends ForUpdateDef,
        Query extends QueryDef>
        extends HavingDef {

    default Having groupBy(ColumnDef... columnDefs) {
        GroupStatement groupStatement = new GroupStatement();
        ListColumnStatement listColumnStatement = new ListColumnStatement(",");
        listColumnStatement.add(Arrays.stream(columnDefs).map(ColumnDef::getStatement).toArray(Statement[]::new));
        groupStatement.setGroup(listColumnStatement);
        statement().setGroupStatement(groupStatement);
        return (Having) creatorFactory().newHavingDef(statement());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy