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

com.bixuebihui.jdbc.SqlGroup Maven / Gradle / Ivy

Go to download

a fast small database connection pool and a active record flavor mini framework

There is a newer version: 1.15.3.3
Show newest version
package com.bixuebihui.jdbc;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author xwx
 */
public class SqlGroup {
    List groupByFieldOrSqlString;
    public SqlGroup(){
        groupByFieldOrSqlString = new ArrayList<>();
    }

    public SqlGroup(SqlGroup groupByClause) {
        assert this.groupByFieldOrSqlString != null;
        this.groupByFieldOrSqlString.addAll(groupByClause.groupByFieldOrSqlString);
    }

    public void add(String... fieldsOrSqlString){
        groupByFieldOrSqlString.addAll(Arrays.asList(fieldsOrSqlString));
    }

    public void clear() {
        groupByFieldOrSqlString.clear();
    }

    @Override
    public String toString() {
        return groupByFieldOrSqlString.size()>0 ? " group by " +
                StringUtils.join(groupByFieldOrSqlString, ",") : "";
    }

    public String[] toArray(){
        return groupByFieldOrSqlString.toArray(new String[groupByFieldOrSqlString.size()]);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy