import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.LinkedList;
+import java.util.List;
import javax.annotation.Nullable;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.common.QName;
private final AbstractStringInstanceIdentifierCodec codec;
private final String data;
- private final LinkedList<PathArgument> product = new LinkedList<>();
+ private final List<PathArgument> product = new LinkedList<>();
private DataSchemaContextNode<?> current;
private int offset;
}
private PathArgument computeNextArgument() {
- checkValid(SLASH == currentChar(),"Identifier must start with '/'.");
+ checkValid(SLASH == currentChar(), "Identifier must start with '/'.");
skipCurrentChar();
-
+ checkValid(!allCharactersConsumed(), "Identifier cannot end with '/'.");
QName name = nextQName();
if(allCharactersConsumed() || SLASH == currentChar()) {
return computeIdentifier(name);
skipWhitespaces();
checkCurrentAndSkip(EQUALS, "Precondition must contain '='");
skipWhitespaces();
- final Object value = deserializeValue(key,nextQuotedValue());
+ final String keyValue = nextQuotedValue();
skipWhitespaces();
checkCurrentAndSkip(PRECONDITION_END, "Precondition must ends with ']'");
// Break-out from method for leaf-list case
if(key == null && currentNode.isLeaf()) {
checkValid(offset == data.length(), "Leaf argument must be last argument of instance identifier.");
- return new YangInstanceIdentifier.NodeWithValue(name, value);
+ return new YangInstanceIdentifier.NodeWithValue(name, keyValue);
}
+ final DataSchemaContextNode<?> keyNode = currentNode.getChild(key);
+ checkValid(keyNode != null, "%s is not correct schema node identifier.", key);
+ final Object value = codec.deserializeKeyValue(keyNode.getDataSchemaNode(), keyValue);
keyValues.put(key, value);
}
return new YangInstanceIdentifier.NodeIdentifierWithPredicates(name, keyValues.build());