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

db.sql.api.cmd.executor.method.IConditionMethod Maven / Gradle / Ivy

There is a newer version: 1.7.6-RC2
Show newest version
package db.sql.api.cmd.executor.method;

import db.sql.api.Getter;
import db.sql.api.cmd.GetterField;
import db.sql.api.cmd.LikeMode;
import db.sql.api.cmd.basic.ICondition;
import db.sql.api.cmd.executor.IQuery;
import db.sql.api.cmd.executor.method.condition.IConditionMethods;
import db.sql.api.cmd.struct.Nested;
import db.sql.api.cmd.struct.conditionChain.IConditionChain;

import java.io.Serializable;
import java.util.Collection;
import java.util.function.Consumer;
import java.util.function.Function;


public interface IConditionMethod
        >
        extends IConditionMethods,
        Nested {

    CONDITION_CHAIN conditionChain();

    default SELF and() {
        conditionChain().and();
        return (SELF) this;
    }

    default SELF or() {
        conditionChain().or();
        return (SELF) this;
    }


    default  SELF and(Getter column, Function f) {
        return this.and(column, 1, f);
    }

    default  SELF and(boolean when, Getter column, Function f) {
        if (!when) {
            return (SELF) this;
        }
        return this.and(column, 1, f);
    }

    default  SELF and(Getter column, int storey, Function f) {
        conditionChain().and(column, storey, f);
        return (SELF) this;
    }

    default  SELF and(boolean when, Getter column, int storey, Function f) {
        if (!when) {
            return (SELF) this;
        }
        return this.and(column, storey, f);
    }

    default  SELF or(Getter column, Function f) {
        return this.or(column, 1, f);
    }

    default  SELF or(boolean when, Getter column, Function f) {
        if (!when) {
            return (SELF) this;
        }
        return this.or(column, 1, f);
    }

    default  SELF or(Getter column, int storey, Function f) {
        conditionChain().or(column, storey, f);
        return (SELF) this;
    }

    default  SELF or(boolean when, Getter column, int storey, Function f) {
        if (!when) {
            return (SELF) this;
        }
        return this.or(column, storey, f);
    }

    default SELF and(GetterField[] getterFields, Function f) {
        conditionChain().and(getterFields, f);
        return (SELF) this;
    }

    default SELF or(GetterField[] getterFields, Function f) {
        conditionChain().or(getterFields, f);
        return (SELF) this;
    }

    default SELF and(boolean when, GetterField[] getterFields, Function f) {
        conditionChain().and(when, getterFields, f);
        return (SELF) this;
    }

    default SELF or(boolean when, GetterField[] getterFields, Function f) {
        conditionChain().or(when, getterFields, f);
        return (SELF) this;
    }

    default SELF and(Function f) {
        conditionChain().and(f.apply((SELF) this));
        return (SELF) this;
    }

    default SELF or(Function f) {
        conditionChain().or(f.apply((SELF) this));
        return (SELF) this;
    }

    @Override
    default SELF andNested(Consumer consumer) {
        conditionChain().andNested(consumer);
        return (SELF) this;
    }

    @Override
    default SELF orNested(Consumer consumer) {
        conditionChain().orNested(consumer);
        return (SELF) this;
    }

    @Override
    default SELF eq(COLUMN column, V value) {
        conditionChain().eq(column, value);
        return (SELF) this;
    }

    @Override
    default SELF ne(COLUMN column, V value) {
        conditionChain().ne(column, value);
        return (SELF) this;
    }

    @Override
    default SELF gt(COLUMN column, V value) {
        conditionChain().gt(column, value);
        return (SELF) this;
    }

    @Override
    default SELF gte(COLUMN column, V value) {
        conditionChain().gte(column, value);
        return (SELF) this;
    }

    @Override
    default SELF lt(COLUMN column, V value) {
        conditionChain().lt(column, value);
        return (SELF) this;
    }

    @Override
    default SELF lte(COLUMN column, V value) {
        conditionChain().lte(column, value);
        return (SELF) this;
    }

    @Override
    default SELF between(COLUMN column, Serializable value, Serializable value2) {
        conditionChain().between(column, value, value2);
        return (SELF) this;
    }

    @Override
    default SELF notBetween(COLUMN column, Serializable value, Serializable value2) {
        conditionChain().notBetween(column, value, value2);
        return (SELF) this;
    }

    @Override
    default SELF like(LikeMode mode, COLUMN column, String value) {
        conditionChain().like(mode, column, value);
        return (SELF) this;
    }

    @Override
    default SELF notLike(LikeMode mode, COLUMN column, String value) {
        conditionChain().notLike(mode, column, value);
        return (SELF) this;
    }

    @Override
    default SELF isNull(COLUMN column) {
        conditionChain().isNull(column);
        return (SELF) this;
    }

    @Override
    default SELF isNotNull(COLUMN column) {
        conditionChain().isNotNull(column);
        return (SELF) this;
    }

    @Override
    default  SELF empty(boolean when, Getter column, int storey) {
        conditionChain().empty(when, column, storey);
        return (SELF) this;
    }

    @Override
    default  SELF notEmpty(boolean when, Getter column, int storey) {
        conditionChain().notEmpty(when, column, storey);
        return (SELF) this;
    }

    @Override
    default SELF empty(COLUMN column) {
        conditionChain().empty(column);
        return (SELF) this;
    }

    @Override
    default SELF notEmpty(COLUMN column) {
        conditionChain().empty(column);
        return (SELF) this;
    }

    @Override
    default  SELF eq(boolean when, Getter column, int storey, V value) {
        conditionChain().eq(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF eq(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().eq(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }

    @Override
    default  SELF ne(boolean when, Getter column, int storey, V value) {
        conditionChain().ne(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF ne(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().ne(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }

    @Override
    default  SELF gt(boolean when, Getter column, int storey, V value) {
        conditionChain().gt(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF gt(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().gt(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }

    @Override
    default  SELF gte(boolean when, Getter column, int storey, V value) {
        conditionChain().gte(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF gte(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().gte(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }

    @Override
    default  SELF lt(boolean when, Getter column, int storey, V value) {
        conditionChain().lt(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF lt(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().lt(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }

    @Override
    default  SELF lte(boolean when, Getter column, int storey, V value) {
        conditionChain().lte(when, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF lte(boolean when, Getter column, int columnStorey, Getter value, int valueStorey) {
        conditionChain().lte(when, column, columnStorey, value, valueStorey);
        return (SELF) this;
    }


    @Override
    default  SELF like(boolean when, LikeMode mode, Getter column, int storey, String value) {
        conditionChain().like(when, mode, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF notLike(boolean when, LikeMode mode, Getter column, int storey, String value) {
        conditionChain().notLike(when, mode, column, storey, value);
        return (SELF) this;
    }

    @Override
    default  SELF between(boolean when, Getter column, int storey, Serializable value, Serializable value2) {
        conditionChain().between(when, column, storey, value, value2);
        return (SELF) this;
    }

    @Override
    default  SELF notBetween(boolean when, Getter column, int storey, Serializable value, Serializable value2) {
        conditionChain().notBetween(when, column, storey, value, value2);
        return (SELF) this;
    }

    @Override
    default  SELF isNull(boolean when, Getter column, int storey) {
        conditionChain().isNull(when, column, storey);
        return (SELF) this;
    }

    @Override
    default  SELF isNotNull(boolean when, Getter column, int storey) {
        conditionChain().isNotNull(when, column, storey);
        return (SELF) this;
    }

    @Override
    default SELF in(COLUMN column, IQuery query) {
        conditionChain().in(column, query);
        return (SELF) this;
    }

    @Override
    default SELF in(COLUMN column, Serializable... values) {
        conditionChain().in(column, values);
        return (SELF) this;
    }

    @Override
    default SELF in(COLUMN column, Collection values) {
        conditionChain().in(column, values);
        return (SELF) this;
    }

    @Override
    default  SELF in(boolean when, Getter column, int storey, IQuery query) {
        conditionChain().in(when, column, storey, query);
        return (SELF) this;
    }

    @Override
    default  SELF in(boolean when, Getter column, int storey, Serializable[] values) {
        conditionChain().in(when, column, storey, values);
        return (SELF) this;
    }

    @Override
    default  SELF in(boolean when, Getter column, int storey, Collection values) {
        conditionChain().in(when, column, storey, values);
        return (SELF) this;
    }

    @Override
    default SELF exists(boolean when, IQuery query) {
        conditionChain().exists(when, query);
        return (SELF) this;
    }

    @Override
    default SELF notExists(boolean when, IQuery query) {
        conditionChain().notExists(when, query);
        return (SELF) this;
    }

    @Override
    default SELF notIn(COLUMN column, IQuery query) {
        conditionChain().notIn(column, query);
        return (SELF) this;
    }

    @Override
    default SELF notIn(COLUMN column, Serializable... values) {
        conditionChain().notIn(column, values);
        return (SELF) this;
    }

    @Override
    default SELF notIn(COLUMN column, Collection values) {
        conditionChain().notIn(column, values);
        return (SELF) this;
    }

    @Override
    default  SELF notIn(boolean when, Getter column, int storey, IQuery query) {
        conditionChain().notIn(when, column, storey, query);
        return (SELF) this;
    }

    @Override
    default  SELF notIn(boolean when, Getter column, int storey, Serializable[] values) {
        conditionChain().notIn(when, column, storey, values);
        return (SELF) this;
    }

    @Override
    default  SELF notIn(boolean when, Getter column, int storey, Collection values) {
        conditionChain().notIn(when, column, storey, values);
        return (SELF) this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy