/** * Get the byte expression of this numeric expression * * @return this.byteValue() * @see java.lang.Number#byteValue() */ public NumberExpression<Byte> byteValue() { return castToNum(Byte.class); }
private List<T> convert(Number... numbers) { List<T> list = new ArrayList<T>(numbers.length); for (int i = 0; i < numbers.length; i++) { list.add(MathUtils.cast(numbers[i], getType())); } return list; }
/** * Create a {@code from <= this <= to} expression * * @param <A> * @param from * @param to * @return */ public final <A extends Number & Comparable<?>> BooleanExpression between(@Nullable A from, @Nullable A to) { if (from == null) { if (to != null) { return loe(to); } else { throw new IllegalArgumentException("Either from or to needs to be non-null"); } } else if (to == null) { return goe(from); } else { return between(ConstantImpl.create(cast(from)), ConstantImpl.create(cast(to))); } }
/** * Create a {@code this >= right} expression * * @param <A> * @param right rhs of the comparison * @return {@code this >= right} * @see java.lang.Comparable#compareTo(Object) */ public final <A extends Number & Comparable<?>> BooleanExpression goe(A right) { return goe(ConstantImpl.create(cast(right))); }
/** * Create a {@code this < right} expression * * @param <A> * @param right rhs of the comparison * @return {@code this < right} * @see java.lang.Comparable#compareTo(Object) */ public final <A extends Number & Comparable<?>> BooleanExpression lt(A right) { return lt(ConstantImpl.create(cast(right))); }
/** * Create a {@code this > right} expression * * @param <A> * @param right rhs of the comparison * @return {@code this > right} * @see java.lang.Comparable#compareTo(Object) */ public final <A extends Number & Comparable<?>> BooleanExpression gt(A right) { return gt(ConstantImpl.create(cast(right))); }
/** * @param right * @return */ public BooleanExpression loeAll(CollectionExpression<?, ? super T> right) { return loe(ExpressionUtils.<T>all(right)); }
@Test public void OrderExpressionInFunctionalWay() { cat.bodyWeight.asc(); cat.bodyWeight.add(kitten.bodyWeight).asc(); }
/** * @param right * @return */ public BooleanExpression ltAny(CollectionExpression<?, ? super T> right) { return lt(ExpressionUtils.<T>any(right)); }
/** * @param right * @return */ public BooleanExpression gtAny(CollectionExpression<?, ? super T> right) { return gt(ExpressionUtils.<T>any(right)); }
/** * Get the result of the operation this / right * * @param right * @return this / right */ public <N extends Number & Comparable<?>> NumberExpression<T> divide(Expression<N> right) { Class<?> type = getDivisionType(getType(), right.getType()); return NumberOperation.create((Class<T>)type, Ops.DIV, mixin, right); }
/** * Create a {@code this <= right} expression * * @param <A> * @param right rhs of the comparison * @return {@code this <= right} * @see java.lang.Comparable#compareTo(Object) */ public final <A extends Number & Comparable<?>> BooleanExpression loe(A right) { return loe(ConstantImpl.create(cast(right))); }
/** * Expr: {@code this like str} * * @param str * @return */ public BooleanExpression like(Expression<String> str) { return BooleanOperation.create(Ops.LIKE, stringValue(), str); }
@Test public void Double() { assertEquals(Double.class, expr.doubleValue().getType()); }