public static Constant<Integer> create(int i) { if (i >= 0 && i < CACHE_SIZE) { return Constants.INTEGERS[i]; } else { return new ConstantImpl<Integer>(Integer.class, i); } }
/** * Create a {@code this like str} expression ignoring case * * @param str string * @param escape escape character * @return this like string */ public BooleanExpression likeIgnoreCase(String str, char escape) { return Expressions.booleanOperation(Ops.LIKE_ESCAPE_IC, mixin, ConstantImpl.create(str), ConstantImpl.create(escape)); }
public static Constant<Character> create(char i) { if (i < CACHE_SIZE) { return Constants.CHARACTERS[i]; } else { return new ConstantImpl<Character>(Character.class, i); } }
/** * Create a {@code locate(str, this, start)} expression * * <p>Get the position of the given String in this String, the first position is 1</p> * * @param str string * @param start start * @return locate(str, this, start) */ public NumberExpression<Integer> locate(String str, int start) { return Expressions.numberOperation(Integer.class, Ops.StringOps.LOCATE2, ConstantImpl.create(str), mixin, ConstantImpl.create(start)); }
public static Constant<Long> create(long i) { if (i >= 0 && i < CACHE_SIZE) { return Constants.LONGS[(int) i]; } else { return new ConstantImpl<Long>(Long.class, i); } }
/** * Returns 1 (TRUE) if this geometric object “spatially crosses’ anotherGeometry. * * @param geometry other geometry * @return true, if crosses */ public BooleanExpression crosses(Geometry geometry) { return crosses(ConstantImpl.create(geometry)); }
/** * Returns the shortest distance between any two Points in the two geometric objects as * calculated in the spatial reference system of this geometric object. Because the geometries * are closed, it is possible to find a point on each geometric object involved, such that the * distance between these 2 points is the returned distance between their geometric objects. * * @param geometry other geometry * @return distance */ public NumberExpression<Double> distance(Geometry geometry) { return distance(ConstantImpl.create(geometry)); }
/** * Returns a geometric object that represents the Point * set difference of this geometric object with anotherGeometry. * * @param geometry other geometry * @return difference between this and the other geometry */ public JTSGeometryExpression<Geometry> difference(Geometry geometry) { return difference(ConstantImpl.create(geometry)); }
/** * Create an expression out of the given order specifiers * * @param args order * @return expression for order */ public static Expression<?> orderBy(List<OrderSpecifier<?>> args) { return operation(Object.class, Ops.ORDER, ConstantImpl.create(args)); }
@SuppressWarnings("unchecked") SimpleConstant(D constant) { super(ConstantImpl.create(constant)); this.constant = constant; }
/** * Create a {@code this.indexOf(str)} expression * * <p>Get the index of the given substring in this String</p> * * @param str string * @return this.indexOf(str) * @see java.lang.String#indexOf(String) */ public NumberExpression<Integer> indexOf(String str) { return indexOf(ConstantImpl.create(str)); }
/** * Create a {@code this like str} expression ignoring case * * @param str string * @param escape escape character * @return this like string */ public BooleanExpression likeIgnoreCase(Expression<String> str, char escape) { return Expressions.booleanOperation(Ops.LIKE_ESCAPE_IC, mixin, str, ConstantImpl.create(escape)); }
/** * Create a {@code locate(str, this)} expression * * <p>Get the position of the given String in this String, the first position is 1</p> * * @param str string * @return locate(str, this) */ public NumberExpression<Integer> locate(String str) { return Expressions.numberOperation(Integer.class, Ops.StringOps.LOCATE, ConstantImpl.create(str), mixin); }
/** * Create a {@code concat(str, this)} expression * * <p>Prepend the given String and return the result</p> * * @param str string * @return str + this */ public StringExpression prepend(String str) { return prepend(ConstantImpl.create(str)); }
/** * Create a {@code this.startsWithIgnoreCase(str)} expression * * @param str string * @return this.startsWithIgnoreCase(str) */ public BooleanExpression startsWithIgnoreCase(String str) { return startsWithIgnoreCase(ConstantImpl.create(str)); }
/** * Create a case expression builder * * @param other * @return case expression builder */ public CaseForEqBuilder<T> when(T other) { return new CaseForEqBuilder<T>(mixin, ConstantImpl.create(other)); }
/** * Finds the closest points relative to the given location and orders the results with decreasing proximity * * @param expr location * @param latVal latitude * @param longVal longitude * @return predicate */ public static BooleanExpression near(Expression<Double[]> expr, double latVal, double longVal) { return Expressions.booleanOperation(MongodbOps.NEAR, expr, ConstantImpl.create(new Double[]{latVal, longVal})); }
/** * Finds the closest points relative to the given location on a sphere and orders the results with decreasing proximity * * @param expr location * @param latVal latitude * @param longVal longitude * @return predicate */ public static BooleanExpression nearSphere(Expression<Double[]> expr, double latVal, double longVal) { return Expressions.booleanOperation(MongodbOps.NEAR_SPHERE, expr, ConstantImpl.create(new Double[]{latVal, longVal})); }
/** * Returns 1 (TRUE) if this geometric object “spatially intersects” anotherGeometry. * * @param geometry other geometry * @return true, if intersects */ public BooleanExpression intersects(Geometry geometry) { return intersects(ConstantImpl.create(geometry)); }