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

net.sf.jsqlparser.statement.alter.AlterSystemStatement 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.

There is a newer version: 5.0
Show 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.alter;

import java.util.List;
import java.util.Objects;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.StatementVisitor;

/**
 *
 * @author Andreas Reichel
 * @see  ALTER SESSION
 */

public class AlterSystemStatement implements Statement {
    private final AlterSystemOperation operation;
    private final List parameters;

    public AlterSystemStatement(AlterSystemOperation operation, List parameters) {
        this.operation = Objects.requireNonNull(operation, "The ALTER SYSTEM Operation must not be Null");
        this.parameters = Objects.requireNonNull(parameters, "The PARAMETERS List must not be null although it can be empty.");
    }

    public AlterSystemOperation getOperation() {
        return operation;
    }

    public List getParameters() {
        return parameters;
    }
      
    @Override
    public void accept(StatementVisitor statementVisitor) {
        statementVisitor.visit(this);
      }
    
    private static void appendParameters(StringBuilder builder, List parameters) {
        for (String s: parameters) {
            builder.append(" ").append(s);
        }
    }
    
    public StringBuilder appendTo(StringBuilder builder) {
        builder.append("ALTER SYSTEM ").append(operation);
        appendParameters(builder, parameters);
        return builder;
    }
    
    @Override
    public String toString() {
        return appendTo(new StringBuilder()).toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy