import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.codec.InstanceIdentifierCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
/**
* Abstract utility class for representations which encode {@link YangInstanceIdentifier} as a
DataSchemaContextNode<?> current = getDataContextTree().getRoot();
for (PathArgument arg : data.getPathArguments()) {
current = current.getChild(arg);
+ Preconditions.checkArgument(current != null,
+ "Invalid input %s: schema for argument %s (after %s) not found", data, arg, sb);
- if(current.isMixin()) {
+ if (current.isMixin()) {
/*
* XML/YANG instance identifier does not have concept
* of augmentation identifier, or list as whole which
- * identifies mixin (same as paretn element),
+ * identifies a mixin (same as the parent element),
* so we can safely ignore it if it is part of path
* (since child node) is identified in same fashion.
- *
*/
continue;
}
}
} else if (arg instanceof NodeWithValue) {
sb.append("[.='");
- sb.append(((NodeWithValue) arg).getValue());
+ sb.append(((NodeWithValue<?>) arg).getValue());
sb.append("']");
}
}
*/
protected abstract @Nonnull DataSchemaContextTree getDataContextTree();
+ protected Object deserializeKeyValue(final DataSchemaNode schemaNode, final String value) {
+ return value;
+ }
+
@Override
public final YangInstanceIdentifier deserialize(final String data) {
Preconditions.checkNotNull(data, "Data may not be null");