Skip to content

Commit 20ef418

Browse files
committed
style: update on like to regex
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
1 parent 0675743 commit 20ef418

File tree

1 file changed

+6
-2
lines changed
  • jnosql-tinkerpop/src/main/java/org/eclipse/jnosql/databases/tinkerpop/communication

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ enum LikeToRegex {
2424

2525
/**
2626
* Converts like pattern to regex pattern.
27+
*
2728
* @param text the like pattern to convert
2829
* @return the regex pattern
2930
*/
3031
String likeToRegex(Object text) {
31-
String like = text== null? null: text.toString();
32+
String like = text == null ? null : text.toString();
3233
if (like == null) {
3334
return "(?!)";
3435
}
@@ -37,7 +38,10 @@ String likeToRegex(Object text) {
3738
for (int i = 0; i < like.length(); i++) {
3839
char c = like.charAt(i);
3940
if (c == '%' || c == '_') {
40-
if (!lit.isEmpty()) { rx.append(java.util.regex.Pattern.quote(lit.toString())); lit.setLength(0); }
41+
if (!lit.isEmpty()) {
42+
rx.append(java.util.regex.Pattern.quote(lit.toString()));
43+
lit.setLength(0);
44+
}
4145
rx.append(c == '%' ? ".*" : ".");
4246
} else {
4347
lit.append(c);

0 commit comments

Comments
 (0)