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

org.neogroup.warp.data.query.traits.HasSelectFields Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version
package org.neogroup.warp.data.query.traits;

import org.neogroup.warp.data.query.fields.SelectField;

import java.util.Collections;
import java.util.List;

public interface HasSelectFields {

    List getSelectFields();

    R setSelectFields (List selectFields);

    default R select(String... fields) {
        List selectFields = getSelectFields();
        for (String field : fields) {
            selectFields.add(new SelectField(field));
        }
        return (R)this;
    }

    default R select(SelectField... fields) {
        Collections.addAll(getSelectFields(), fields);
        return (R)this;
    }

    default R selectField (SelectField field) {
        getSelectFields().add (field);
        return (R)this;
    }

    default R selectField (String name) {
        return selectField(name, null);
    }

    default R selectField (String name, String alias) {
        return selectField(null, name, alias);
    }

    default R selectField (String tableName, String name, String alias) {
        return selectField(new SelectField(tableName, name, alias));
    }

    default R clearSelectFields () {
        getSelectFields().clear();
        return (R)this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy