File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
jnosql-tinkerpop/src/main/java/org/eclipse/jnosql/databases/tinkerpop/communication Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 Contributors to the Eclipse Foundation
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License v1.0
5+ * and Apache License v2.0 which accompanies this distribution.
6+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+ * and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+ *
9+ * You may elect to redistribute this code under either of these licenses.
10+ *
11+ * Contributors:
12+ *
13+ * Otavio Santana
14+ */
15+ package org .eclipse .jnosql .databases .tinkerpop .communication ;
16+
17+ import java .util .regex .Pattern ;
18+
19+ public enum LikeToRegex {
20+ INSTANCE ;
21+
22+
23+ private static String LikeToRegex (String likePattern ) {
24+ if (likePattern == null ) {
25+ return "a^" ;
26+ } // match nothing
27+ StringBuilder sb = new StringBuilder ("^" );
28+ for (char c : likePattern .toCharArray ()) {
29+ switch (c ) {
30+ case '%' : sb .append (".*" ); break ;
31+ case '_' : sb .append ('.' ); break ;
32+ default : sb .append (Pattern .quote (String .valueOf (c )));
33+ }
34+ }
35+ sb .append ('$' );
36+ return sb .toString ();
37+ }
38+
39+ }
You can’t perform that action at this time.
0 commit comments