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

com.jn.sqlhelper.dialect.expression.InExpression Maven / Gradle / Ivy

package com.jn.sqlhelper.dialect.expression;

import com.jn.langx.expression.operator.AbstractBinaryOperator;
import com.jn.langx.util.hash.HashCodeBuilder;

public class InExpression extends AbstractBinaryOperator implements SQLExpression, Notable, SymbolExpression {

    private boolean isNotExpression;

    public InExpression() {
        this(false);
    }

    public InExpression(boolean not) {
        not(not);
    }

    @Override
    public void not(boolean isNotExpression) {
        this.isNotExpression = isNotExpression;
    }

    @Override
    public boolean not() {
        return isNotExpression;
    }

    @Override
    public SQLExpression execute() {
        return this;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder(255);
        builder.append(getLeft().toString())
                .append(not() ? " not in " : " in ")
                .append(getRight().toString());
        return builder.toString();
    }

    public int hashCode(){
        return new HashCodeBuilder().with(not()).with(super.hashCode()).build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy