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

cn.javaer.jany.jooq.condition.ContainedInCondition Maven / Gradle / Ivy

package cn.javaer.jany.jooq.condition;

import org.jooq.Context;
import org.jooq.Field;
import org.jooq.impl.CustomCondition;

import static org.jooq.impl.DSL.val;

/**
 * @author cn-src
 */
public final class ContainedInCondition extends CustomCondition {

    private static final long serialVersionUID = -643041960796102638L;
    private final Field lhs;
    private final Field rhs;
    private final T value;

    public ContainedInCondition(final Field field, final T value) {
        this.lhs = field;
        this.rhs = null;
        this.value = value;
    }

    public ContainedInCondition(final Field field, final Field rhs) {
        this.lhs = field;
        this.rhs = rhs;
        this.value = null;
    }

    @Override
    public void accept(final Context ctx) {
        ctx.visit(this.lhs).sql(" <@ ").visit(this.rhs());
    }

    private Field rhs() {
        return (this.rhs == null) ? val(this.value, this.lhs) : this.rhs;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy