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

com.github.wz2cool.dynamic.builder.DynamicQueryBuilderHelper Maven / Gradle / Ivy

There is a newer version: 3.2.32
Show newest version
package com.github.wz2cool.dynamic.builder;

import com.github.wz2cool.dynamic.FilterCondition;
import com.github.wz2cool.dynamic.builder.direction.Ascending;
import com.github.wz2cool.dynamic.builder.direction.Descending;
import com.github.wz2cool.dynamic.builder.opeartor.*;
import com.github.wz2cool.dynamic.lambda.*;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;

/**
 * @author Frank
 */
public class DynamicQueryBuilderHelper {

    private DynamicQueryBuilderHelper() {
    }

    /// region and operator

    public static  LessThan lessThan(R value) {
        return new LessThan<>(value);
    }

    public static  LessThanOrEqual lessThanOrEqual(R value) {
        return new LessThanOrEqual<>(value);
    }

    public static  Equal isEqual(R value) {
        return new Equal<>(value);
    }

    public static  NotEqual notEqual(R value) {
        return new NotEqual<>(value);
    }

    public static  GreaterThanOrEqual greaterThanOrEqual(R value) {
        return new GreaterThanOrEqual<>(value);
    }

    public static  GreaterThan greaterThan(R value) {
        return new GreaterThan<>(value);
    }

    public static  StartWith startWith(R value) {
        return new StartWith<>(value);
    }

    public static  EndWith endWith(R value) {
        return new EndWith<>(value);
    }

    public static  Contains contains(R value) {
        return new Contains<>(value);
    }

    @SafeVarargs
    public static  In in(R... values) {
        return new In<>(values);
    }

    public static  In in(Collection values) {
        return new In<>(values);
    }

    @SafeVarargs
    public static  NotIn notIn(R... values) {
        return new NotIn<>(values);
    }

    public static  NotIn notIn(Collection values) {
        return new NotIn<>(values);
    }

    public static  Between between(R value1, R value2) {
        return new Between<>(value1, value2);
    }

    /// endregion

    /// region sort direction

    private static final Ascending ASC = new Ascending();
    private static final Descending DESC = new Descending();

    public static Ascending asc() {
        return ASC;
    }

    public static Descending desc() {
        return DESC;
    }

    /// endregion

    /// region and

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetBigDecimalPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetBytePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetDatePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetDoublePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetFloatPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetIntegerPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetLongPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetShortPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder and(
            GetStringPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.AND, getPropertyFunction, operator, conditionClauseBuilders);
    }

    /// endregion

    /// region or

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetBigDecimalPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetBytePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetDatePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetDoublePropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetFloatPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetIntegerPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetLongPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetShortPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    @SafeVarargs
    public static  ConditionClauseBuilder or(
            GetStringPropertyFunction getPropertyFunction, IFilterOperator operator,
            ConditionClauseBuilder... conditionClauseBuilders) {
        return new ConditionClauseBuilder<>(
                FilterCondition.OR, getPropertyFunction, operator, conditionClauseBuilders);
    }

    /// endregion
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy