Move model.util.RegexUtils 91/95091/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 9 Feb 2021 13:33:30 +0000 (14:33 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 9 Feb 2021 17:42:33 +0000 (17:42 +0000)
These utilities are used only by PatternStatementSupport, move them
there to reduce yang-parser-rfc7950 dependencies.

JIRA: YANGTOOLS-1052
Change-Id: I3a039c4d96b296e8fd3f71c248221ff9b815997e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/PatternStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/RegexUtils.java [moved from yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/RegexUtils.java with 98% similarity]
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/Bug4079Test.java [moved from yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Bug4079Test.java with 99% similarity]
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/Bug5410Test.java [moved from yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Bug5410Test.java with 99% similarity]

index 4b9c47e1df1ff850a34d065d89c9adc8a0bb559b..39b4de8cf4ec0089c3a99cf7ddab18c8e12b33b3 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.PatternEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PatternExpression;
 import org.opendaylight.yangtools.yang.model.api.stmt.PatternStatement;
 import org.opendaylight.yangtools.yang.model.spi.stmt.DeclaredStatements;
-import org.opendaylight.yangtools.yang.model.util.RegexUtils;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
similarity index 98%
rename from yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/RegexUtils.java
rename to yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/RegexUtils.java
index 03ae39bc5d82d4b2005b53918c070b5818ececaf..2da907a189373ad7a87da4bbc566cd6170356de5 100644 (file)
@@ -5,8 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
-package org.opendaylight.yangtools.yang.model.util;
+package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.pattern;
 
 import com.google.common.collect.ImmutableSet;
 import java.util.regex.Matcher;
@@ -18,7 +17,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Utilities for converting YANG XSD regexes into Java-compatible regexes.
  */
-public final class RegexUtils {
+final class RegexUtils {
     private static final Logger LOG = LoggerFactory.getLogger(RegexUtils.class);
     private static final Pattern BETWEEN_CURLY_BRACES_PATTERN = Pattern.compile("\\{(.+?)\\}");
     private static final ImmutableSet<String> JAVA_UNICODE_BLOCKS = ImmutableSet.<String>builder()
@@ -244,7 +243,7 @@ public final class RegexUtils {
      * @param xsdRegex XSD regex pattern as it is defined in a YANG source
      * @return Java-compatible regex
      */
-    public static String getJavaRegexFromXSD(final String xsdRegex) {
+    static String getJavaRegexFromXSD(final String xsdRegex) {
         // Note: we are using a non-capturing group to deal with internal structure issues, like branches and similar.
         return "^(?:" + fixUnicodeScriptPattern(escapeChars(xsdRegex)) + ")$";
     }
similarity index 99%
rename from yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Bug4079Test.java
rename to yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/Bug4079Test.java
index d41d8e3bd056bdefb55f2dcb382a1b6038dd5bdd..8c7ad491c1b85a96a4f1cf0d01a253824544893a 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.model.util;
+package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.pattern;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 99%
rename from yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Bug5410Test.java
rename to yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/pattern/Bug5410Test.java
index 50f27f9f6107418105fdc6e31b2c0d9eb94a062a..0fc042737f093e13ec6b64be39ace0ac4acbe662 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.model.util;
+package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.pattern;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;