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

org.babyfish.jimmer.sql.ast.Expression Maven / Gradle / Ivy

There is a newer version: 0.8.180
Show newest version
package org.babyfish.jimmer.sql.ast;

import org.babyfish.jimmer.sql.ast.impl.*;
import org.babyfish.jimmer.sql.ast.query.TypedSubQuery;
import org.babyfish.jimmer.sql.ast.tuple.*;

import java.util.Collection;
import java.util.function.Consumer;

public interface Expression extends Selection {

    /**
     * Check if two expressions are equal.
     *
     * 
    *
  • If {@code this} is null literal, returns {@code other.isNull()}
  • *
  • {@code other} is null literal, returns {@code this.isNull()}
  • *
* * @param other Right operand of expression * @return A predicate */ Predicate eq(Expression other); /** * Check if two expressions are equal. * *
    *
  • If {@code other} is null, returns {@code this.isNull()}
  • *
* @param other Right operand of expression * @return A predicate */ Predicate eq(T other); /** * Check if two expressions are not equal. * *
    *
  • If {@code this} is null literal, returns {@code other.isNotNull()}
  • *
  • {@code other} is null literal, returns {@code this.isNotNull()}
  • *
* * @param other Right operand of expression * @return A predicate */ Predicate ne(Expression other); /** * Check if two expressions are not equal. * *
    *
  • If {@code other} is null, returns {@code this.isNotNull()}
  • *
* @param other Right operand of expression * @return A predicate */ Predicate ne(T other); Predicate isNull(); Predicate isNotNull(); Predicate in(Collection values); Predicate notIn(Collection values); Predicate in(TypedSubQuery subQuery); Predicate notIn(TypedSubQuery subQuery); NumericExpression count(); NumericExpression count(boolean distinct); Expression coalesce(T defaultValue); Expression coalesce(Expression defaultExpr); CoalesceBuilder coalesceBuilder(); static NumericExpression constant(N value) { return Constants.number(value); } static StringFactory string() { return ExpressionFactories.of(StringFactory.class); } static NumericFactory numeric() { return ExpressionFactories.of(NumericFactory.class); } static ComparableFactory comparable() { return ExpressionFactories.of(ComparableFactory.class); } static AnyFactory any() { return ExpressionFactories.of(AnyFactory.class); } static Expression nullValue(Class type) { return any().nullValue(type); } static Expression> tuple( Expression expr1, Expression expr2 ) { return new Tuples.Expr2<>(expr1, expr2); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3 ) { return new Tuples.Expr3<>(expr1, expr2, expr3); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4 ) { return new Tuples.Expr4<>(expr1, expr2, expr3, expr4); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4, Expression expr5 ) { return new Tuples.Expr5<>(expr1, expr2, expr3, expr4, expr5); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4, Expression expr5, Expression expr6 ) { return new Tuples.Expr6<>(expr1, expr2, expr3, expr4, expr5, expr6); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4, Expression expr5, Expression expr6, Expression expr7 ) { return new Tuples.Expr7<>(expr1, expr2, expr3, expr4, expr5, expr6, expr7); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4, Expression expr5, Expression expr6, Expression expr7, Expression expr8 ) { return new Tuples.Expr8<>(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8); } static Expression> tuple( Expression expr1, Expression expr2, Expression expr3, Expression expr4, Expression expr5, Expression expr6, Expression expr7, Expression expr8, Expression expr9 ) { return new Tuples.Expr9<>(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9); } interface StringFactory { StringExpression value(String value); StringExpression sql(String sql); StringExpression sql(String sql, Consumer block); SimpleCaseBuilder.Str caseBuilder(C value); SimpleCaseBuilder.Str caseBuilder(Expression expression); CaseBuilder.Str caseBuilder(); } interface NumericFactory { NumericExpression value(N value); NumericExpression sql(Class type, String sql); NumericExpression sql( Class type, String sql, Consumer block ); SimpleCaseBuilder.Num caseBuilder(Class type, C value); SimpleCaseBuilder.Num caseBuilder(Class type, Expression expression); CaseBuilder.Num caseBuilder(Class type); } interface ComparableFactory { > ComparableExpression value(T value); > ComparableExpression sql(Class type, String sql); > ComparableExpression sql( Class type, String sql, Consumer block ); > SimpleCaseBuilder.Cmp caseBuilder(Class type, C value); > SimpleCaseBuilder.Cmp caseBuilder(Class type, Expression expression); > CaseBuilder.Cmp caseBuilder(Class type); } interface AnyFactory { Expression value(T value); Expression nullValue(Class type); Expression sql(Class type, String sql); Expression sql( Class type, String sql, Consumer block ); SimpleCaseBuilder caseBuilder(Class type, C value); SimpleCaseBuilder caseBuilder(Class type, Expression expression); CaseBuilder caseBuilder(Class type); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy