Migrate rawStatementArgument()/getStatementSourceReference() callers
[yangtools.git] / yang / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / meta / StmtContextUtils.java
index 1262a3e6ab1d508702b4db58f1b216c204c764bf..f5fde6a803fddcd88fe09b0f4e00c5943e724fdc 100644 (file)
@@ -453,7 +453,7 @@ public final class StmtContextUtils {
         leafStmtCtx.allSubstatements().forEach(leafSubstmtCtx -> {
             final StatementDefinition statementDef = leafSubstmtCtx.publicDefinition();
             SourceException.throwIf(YangStmtMapping.IF_FEATURE.equals(statementDef)
-                    || YangStmtMapping.WHEN.equals(statementDef), leafStmtCtx.getStatementSourceReference(),
+                    || YangStmtMapping.WHEN.equals(statementDef), leafStmtCtx.sourceReference(),
                     "%s statement is not allowed in %s leaf statement which is specified as a list key.",
                     statementDef.getStatementName(), leafStmtCtx.getStatementArgument());
         });
@@ -489,8 +489,7 @@ public final class StmtContextUtils {
                 }
         }
 
-        return internedQName(ctx,
-            InferenceException.throwIfNull(qnameModule, ctx.getStatementSourceReference(),
+        return internedQName(ctx, InferenceException.throwIfNull(qnameModule, ctx.sourceReference(),
             "Cannot resolve QNameModule for '%s'", value), localName);
     }
 
@@ -504,15 +503,14 @@ public final class StmtContextUtils {
      * @throws SourceException if the string is not a valid YANG identifier
      */
     public static QName parseIdentifier(final StmtContext<?, ?, ?> ctx, final String str) {
-        SourceException.throwIf(str.isEmpty(), ctx.getStatementSourceReference(),
-                "Identifier may not be an empty string");
+        SourceException.throwIf(str.isEmpty(), ctx.sourceReference(), "Identifier may not be an empty string");
         return internedQName(ctx, str);
     }
 
     public static QName parseNodeIdentifier(final StmtContext<?, ?, ?> ctx, final String prefix,
             final String localName) {
         return internedQName(ctx,
-            InferenceException.throwIfNull(getModuleQNameByPrefix(ctx, prefix), ctx.getStatementSourceReference(),
+            InferenceException.throwIfNull(getModuleQNameByPrefix(ctx, prefix), ctx.sourceReference(),
                 "Cannot resolve QNameModule for '%s'", prefix),
             localName);
     }
@@ -527,8 +525,7 @@ public final class StmtContextUtils {
      * @throws SourceException if the string is not a valid YANG node identifier
      */
     public static QName parseNodeIdentifier(final StmtContext<?, ?, ?> ctx, final String str) {
-        SourceException.throwIf(str.isEmpty(), ctx.getStatementSourceReference(),
-                "Node identifier may not be an empty string");
+        SourceException.throwIf(str.isEmpty(), ctx.sourceReference(), "Node identifier may not be an empty string");
 
         final int colon = str.indexOf(':');
         if (colon == -1) {
@@ -536,11 +533,9 @@ public final class StmtContextUtils {
         }
 
         final String prefix = str.substring(0, colon);
-        SourceException.throwIf(prefix.isEmpty(), ctx.getStatementSourceReference(),
-            "String '%s' has an empty prefix", str);
+        SourceException.throwIf(prefix.isEmpty(), ctx.sourceReference(), "String '%s' has an empty prefix", str);
         final String localName = str.substring(colon + 1);
-        SourceException.throwIf(localName.isEmpty(), ctx.getStatementSourceReference(),
-            "String '%s' has an empty identifier", str);
+        SourceException.throwIf(localName.isEmpty(), ctx.sourceReference(), "String '%s' has an empty identifier", str);
 
         return parseNodeIdentifier(ctx, prefix, localName);
     }
@@ -555,7 +550,7 @@ public final class StmtContextUtils {
         try {
             template = QName.create(module, localName);
         } catch (IllegalArgumentException e) {
-            throw new SourceException(ctx.getStatementSourceReference(), e, "Invalid identifier '%s'", localName);
+            throw new SourceException(ctx.sourceReference(), e, "Invalid identifier '%s'", localName);
         }
         return template.intern();
     }