Skip to content

Commit e65c520

Browse files
committed
feat: udpate traversal convertor
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
1 parent 269ff5b commit e65c520

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

jnosql-tinkerpop/src/main/java/org/eclipse/jnosql/databases/tinkerpop/communication/LikeToRegex.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
*/
1515
package org.eclipse.jnosql.databases.tinkerpop.communication;
1616

17-
import java.util.regex.Pattern;
1817

19-
public enum LikeToRegex {
18+
/**
19+
* The like to regex converter
20+
*/
21+
enum LikeToRegex {
2022
INSTANCE;
2123

2224

@@ -25,7 +27,7 @@ public enum LikeToRegex {
2527
* @param text the like pattern to convert
2628
* @return the regex pattern
2729
*/
28-
private static String LikeToRegex(Object text) {
30+
String likeToRegex(Object text) {
2931
String like = text== null? null: text.toString();
3032
if (like == null) {
3133
return "(?!)";

jnosql-tinkerpop/src/main/java/org/eclipse/jnosql/databases/tinkerpop/communication/TraversalExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static GraphTraversal<Vertex, Vertex> getPredicate(CriteriaCondition condition)
4343
return __.has(name, P.eq(value));
4444
}
4545
case LIKE -> {
46-
return __.has(name, TextP.regex(value == null ? "" : value.toString()));
46+
return __.has(name, TextP.regex(LikeToRegex.INSTANCE.likeToRegex(value)));
4747
}
4848
case ENDS_WITH -> {
4949
return __.has(name, TextP.endingWith(value == null ? "" : value.toString()));

0 commit comments

Comments
 (0)