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

net.sf.jsqlparser.statement.UnsupportedStatement Maven / Gradle / Ivy

Go to download

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern.

The newest version!
/*-
 * #%L
 * JSQLParser library
 * %%
 * Copyright (C) 2004 - 2021 JSQLParser
 * %%
 * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
 * #L%
 */

package net.sf.jsqlparser.statement;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author Andreas Reichel
 */

public class UnsupportedStatement implements Statement {
    private List declarations;

    public UnsupportedStatement(List declarations) {
        this.declarations =
                Objects.requireNonNull(declarations, "The List of Tokens must not be null.");
    }

    public UnsupportedStatement(String upfront, List declarations) {
        this.declarations = new ArrayList<>();
        this.declarations.add(upfront);
        this.declarations.addAll(
                Objects.requireNonNull(declarations, "The List of Tokens must not be null."));
    }

    @Override
    public  T accept(StatementVisitor statementVisitor, S context) {
        return statementVisitor.visit(this, context);
    }

    @SuppressWarnings({"PMD.MissingBreakInSwitch", "PMD.SwitchStmtsShouldHaveDefault",
            "PMD.CyclomaticComplexity"})
    public StringBuilder appendTo(StringBuilder builder) {
        int i = 0;
        for (String s : declarations) {
            if (i > 0) {
                builder.append(" ");
            }
            builder.append(s);
            i++;
        }
        return builder;
    }

    @Override
    public String toString() {
        return appendTo(new StringBuilder()).toString();
    }

    public boolean isEmpty() {
        return declarations.isEmpty();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy