Remove Utils.transformKeysStringToKeyNodes() 31/65431/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 11 Nov 2017 11:17:59 +0000 (12:17 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 13 Nov 2017 10:39:43 +0000 (11:39 +0100)
This method is not used anywhere and the same function is performed
by KeyStatementSupport.parseArgumentValue(). Remove this method.

Change-Id: I115b9021d16a2da82bbe35344d20ce9a836c9744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/Utils.java

index 80f695680c20acec1f959ddb09478b6843f7a805..8c9c469fbf3abf56bfd3d862852204d94e08621b 100644 (file)
@@ -14,11 +14,8 @@ import com.google.common.base.CharMatcher;
 import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableBiMap;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import javax.annotation.Nonnull;
@@ -46,7 +43,6 @@ public final class Utils {
     private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
     private static final CharMatcher ANYQUOTE_MATCHER = CharMatcher.anyOf("'\"");
     private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings().trimResults();
-    private static final Splitter SPACE_SPLITTER = Splitter.on(' ').omitEmptyStrings().trimResults();
     private static final Splitter COLON_SPLITTER = Splitter.on(":").omitEmptyStrings().trimResults();
     private static final Pattern PATH_ABS = Pattern.compile("/[^/].*");
     @RegEx
@@ -77,24 +73,6 @@ public final class Utils {
         XPATH_FACTORY.remove();
     }
 
-    public static Collection<SchemaNodeIdentifier.Relative> transformKeysStringToKeyNodes(
-            final StmtContext<?, ?, ?> ctx, final String value) {
-        final List<String> keyTokens = SPACE_SPLITTER.splitToList(value);
-
-        // to detect if key contains duplicates
-        if (new HashSet<>(keyTokens).size() < keyTokens.size()) {
-            // FIXME: report all duplicate keys
-            throw new SourceException(ctx.getStatementSourceReference(), "Duplicate value in list key: %s", value);
-        }
-
-        final Set<SchemaNodeIdentifier.Relative> keyNodes = new HashSet<>();
-        for (final String keyToken : keyTokens) {
-            keyNodes.add(SchemaNodeIdentifier.SAME.createChild(StmtContextUtils.qnameFromArgument(ctx, keyToken)));
-        }
-
-        return keyNodes;
-    }
-
     private static String trimSingleLastSlashFromXPath(final String path) {
         return path.endsWith("/") ? path.substring(0, path.length() - 1) : path;
     }