use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_TwoChars_Mix.
@Test
public void testEscape_TwoChars_Mix() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "ab%c_");
LikeExpressionHelper.escape(node);
assertEquals("ab!%c!_", node.getOperand(1));
assertEquals('!', node.getEscapeChar());
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_AltEscapeChar2.
@Test
public void testEscape_AltEscapeChar2() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "a!%c#_");
LikeExpressionHelper.escape(node);
assertEquals("a!$%c#$_", node.getOperand(1));
assertEquals('$', node.getEscapeChar());
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method startsWithExp.
/**
* @since 4.0
* @see ExpressionFactory#startsWithExp(String, String)
*/
static Expression startsWithExp(Expression exp, String value) {
ASTLike like = likeExpInternal(exp, value, (char) 0);
LikeExpressionHelper.toStartsWith(like);
return like;
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method startsWithExp.
/**
* @return An expression for a database "LIKE" query with the value
* converted to a pattern matching the beginning of the String.
* @since 4.0
*/
public static Expression startsWithExp(String pathSpec, String value) {
ASTLike like = likeExpInternal(pathSpec, value, (char) 0);
LikeExpressionHelper.toStartsWith(like);
return like;
}
use of org.apache.cayenne.exp.parser.ASTLike in project cayenne by apache.
the class ExpressionFactory method endsWithExp.
/**
* @return An expression for a database "LIKE" query with the value
* converted to a pattern matching the beginning of the String.
* @since 4.0
*/
public static Expression endsWithExp(String pathSpec, String value) {
ASTLike like = likeExpInternal(pathSpec, value, (char) 0);
LikeExpressionHelper.toEndsWith(like);
return like;
}
Aggregations