/** * Exports this geometric object to a specific Well-known Binary Representation of * Geometry. * * @return binary representation */ public SimpleExpression<byte[]> asBinary() { if (binary == null) { binary = Expressions.operation(byte[].class, SpatialOps.AS_BINARY, mixin); } return binary; }
/** * Exports this geometric object to a specific Well-known Binary Representation of * Geometry. * * @return binary representation */ public SimpleExpression<byte[]> asBinary() { if (binary == null) { binary = Expressions.operation(byte[].class, SpatialOps.AS_BINARY, mixin); } return binary; }
@Override protected SimpleExpression<A> createResult(Class<? extends A> type, Expression<A> last) { return Expressions.operation(type, Ops.CASE, last); }
@Override protected Expression<T> createResult(Class<T> type, Expression<T> last) { return Expressions.operation(type, Ops.CASE_EQ, base, last); } }.when(other).then(expr);
/** * Create a {@code nullif(this, other)} expression * * @param other * @return nullif(this, other) */ public SimpleExpression<T> nullif(Expression<T> other) { return Expressions.operation(this.getType(), Ops.NULLIF, this, other); }
/** * Create an alias for the expression * * @return alias expression */ @Override public SimpleExpression<T> as(Path<T> alias) { return Expressions.operation(getType(),Ops.ALIAS, mixin, alias); }
@SuppressWarnings("unchecked") public Q otherwise(Expression<A> expr) { if (expr == null) { expr = (Expression) NullExpression.DEFAULT; } cases.add(0, new CaseElement<A>(null, expr)); Expression<A> last = null; for (CaseElement<A> element : cases) { if (last == null) { last = Expressions.operation(type, Ops.CASE_ELSE, element.getTarget()); } else { last = Expressions.operation(type, Ops.CASE_WHEN, element.getCondition(), element.getTarget(), last); } } return createResult(type, last); }
/** * Create a {@code source as alias} expression * * @param source source * @param alias alias * @param <D> * @return source as alias */ public static <D> SimpleExpression<D> as(Expression<D> source, Path<D> alias) { if (source == null) { return as(Expressions.<D>nullExpression(), alias); } else { return operation(alias.getType(), Ops.ALIAS, source, alias); } }
@Test public void operation() { assertEquals("a && b", Expressions.operation(Boolean.class, Ops.AND, a, b).toString()); }
@Override protected Expression<T> createResult(Class<T> type, Expression<T> last) { return Expressions.operation(type, Ops.CASE_EQ, base, last); } }.when(other).then(expr);
@Override protected SimpleExpression<A> createResult(Class<? extends A> type, Expression<A> last) { return Expressions.operation(type, Ops.CASE, last); }
/** * Create a nextval(sequence) expression of the given type * * <p>Returns the next value from the given sequence</p> * * @param type type of call * @param sequence sequence name * @return nextval(sequence) */ public static <T extends Number> SimpleExpression<T> nextval(Class<T> type, String sequence) { return Expressions.operation(type, SQLOps.NEXTVAL, ConstantImpl.create(sequence)); }
/** * Create an alias for the expression * * @return alias expression */ @Override public SimpleExpression<T> as(Path<T> alias) { return Expressions.operation(getType(),Ops.ALIAS, mixin, alias); }
/** * Create a {@code nullif(this, other)} expression * * @param other * @return nullif(this, other) */ public SimpleExpression<T> nullif(Expression<T> other) { return Expressions.operation(this.getType(), Ops.NULLIF, this, other); }
@SuppressWarnings("unchecked") public SimpleExpression<A> as(Expression<A> alias) { return Expressions.operation(getType(), Ops.ALIAS, this, alias); }
/** * Create an assignment expression * * @param target target expression * @param value value to be set * @param <T> * @return target = value */ public static <T> Expression<T> set(Path<T> target, Expression<? extends T> value) { if (value != null) { return Expressions.operation(target.getType(), SQLOps.SET_PATH, target, value); } else { return Expressions.operation(target.getType(), SQLOps.SET_LITERAL, target, Expressions.nullExpression()); } }
/** * Create an assignment expression * * @param target target expression * @param value value to be set * @param <T> * @return target = value */ public static <T> Expression<T> set(Path<T> target, T value) { if (value != null) { return Expressions.operation(target.getType(), SQLOps.SET_LITERAL, target, Expressions.constant(value)); } else { return Expressions.operation(target.getType(), SQLOps.SET_LITERAL, target, Expressions.nullExpression()); } }
@Override public WithBuilder<Q> with(Path<?> alias, Path<?>... columns) { Expression<?> columnsCombined = ExpressionUtils.list(Object.class, columns); Expression<?> aliasCombined = Expressions.operation(alias.getType(), SQLOps.WITH_COLUMNS, alias, columnsCombined); return new WithBuilder<Q>(queryMixin, aliasCombined); }
public SimpleExpression<A> as(String alias) { return Expressions.operation(getType(), Ops.ALIAS, this, ExpressionUtils.path(getType(), alias)); }
/** * Create a {@code source as alias} expression * * @param source source * @param alias alias * @param <D> * @return source as alias */ public static <D> SimpleExpression<D> as(Expression<D> source, Path<D> alias) { if (source == null) { return as(Expressions.<D>nullExpression(), alias); } else { return operation(alias.getType(), Ops.ALIAS, source, alias); } }