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

io.wizzie.enricher.query.antlr4.Query Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
package io.wizzie.enricher.query.antlr4;

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

import static com.cookingfox.guava_preconditions.Preconditions.checkNotNull;

public class Query {

    Select select;
    List joins;
    List enrichWiths;
    Stream insertTopic;

    public Query(Select select, Stream insertTopic) {
        this(select, insertTopic, Collections.EMPTY_LIST);
    }

    public Query(Select select, Stream insertTopic, List joins) {
        this(select, insertTopic, joins, Collections.EMPTY_LIST);
    }

    public Query(Select select, Stream insertTopic, List joins, List enrichWiths) {
        this.select = checkNotNull(select, "SELECT cannot be null");
        this.joins = checkNotNull(joins, "JOINS cannot be null");
        this.insertTopic = checkNotNull(insertTopic, "INSERT cannot be null");
        this.enrichWiths = checkNotNull(enrichWiths, "ENRICH WITH cannot be null");
    }

    public void setSelect(Select newSelect) {
        select = newSelect;
    }

    public Select getSelect() {
        return select;
    }

    public void setJoins(List newJoinsList) {
        joins = newJoinsList;
    }

    public List getJoins() {
        return joins;
    }

    public void addJoin(Join newJoin) {
        joins.add(newJoin);
    }

    public void setinsert(Stream newStream) {
        insertTopic = newStream;
    }

    public Stream getInsert() {
        return insertTopic;
    }

    public void setEnrichWiths(List enrichWiths) {
        this.enrichWiths = enrichWiths;
    }

    public List getEnrichWiths() {
        return this.enrichWiths;
    }

    public void validate() {
        checkNotNull(select, "SELECT cannot be null");
        select.validate();

        checkNotNull(joins, "JOINS cannot be null");
        joins.forEach(Join::validate);

        checkNotNull(insertTopic, "INSERT cannot be null");
        insertTopic.validate();

        checkNotNull(enrichWiths, "ENRICH WITH cannot be null");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy