@Override public DataSchemaNode getDataChildByName(final String s) { return getCurrentSchema().getDataChildByName(s); }
@Override public DataSchemaNode getDataChildByName(final QName qName) { return getCurrentSchema().getDataChildByName(qName); }
@Override public SchemaOrderedNormalizedNodeWriter write(final NormalizedNode<?, ?> node) throws IOException { if (Objects.equals(root, schemaContext)) { currentSchemaNode = schemaContext.getDataChildByName(node.getNodeType()); } else { currentSchemaNode = root; } return write(node, currentSchemaNode); }
@Override public SchemaOrderedNormalizedNodeWriter write(final NormalizedNode<?, ?> node) throws IOException { if (Objects.equals(root, schemaContext)) { currentSchemaNode = schemaContext.getDataChildByName(node.getNodeType()); } else { currentSchemaNode = root; } return write(node, currentSchemaNode); }
private NormalizedNode<?, ?> wrapDataObjects(final YangInstanceIdentifier yangInstanceIdentifier, final InstanceIdentifier<? extends DataObject> instanceIdentifier, final Collection<? extends DataObject> dataObjects) { final Collection<NormalizedNode<?, ?>> normalizedRootElements = Collections2 .transform(dataObjects, toNormalizedNodeFunction(instanceIdentifier)); final DataSchemaNode schemaNode = globalContext.getDataChildByName(yangInstanceIdentifier.getLastPathArgument().getNodeType()); if (schemaNode instanceof ListSchemaNode) { // In case of a list, wrap all the values in a Mixin parent node final ListSchemaNode listSchema = (ListSchemaNode) schemaNode; return wrapListIntoMixinNode(normalizedRootElements, listSchema); } else { Preconditions.checkState(dataObjects.size() == 1, "Singleton list was expected"); return getOnlyElement(normalizedRootElements); } }
public OrderedNormalizedNodeWriter write(final NormalizedNode<?, ?> node) throws IOException { if (root == schemaContext) { return write(node, schemaContext.getDataChildByName(node.getNodeType())); } return write(node, root); }
@SuppressWarnings("unchecked") @Override public DataContainerCodecContext<?, ?> load(final QName qname) { final DataSchemaNode childSchema = getSchema().getDataChildByName(qname); childNonNull(childSchema, qname, "Argument %s is not valid child of %s", qname, getSchema()); if (childSchema instanceof DataNodeContainer || childSchema instanceof ChoiceSchemaNode) { @SuppressWarnings("rawtypes") final Class childCls = factory().getRuntimeContext().getClassForSchema(childSchema); return streamChild(childCls); } throw new UnsupportedOperationException("Unsupported child type " + childSchema.getClass()); } });
if (it.hasNext()) { topLevelElement = it.next(); final DataSchemaNode dataChildByName = ctx.getDataChildByName(topLevelElement.getNodeType()); checkNotNull(dataChildByName, "Cannot find %s node in schema context. Instance identifier has to start from root", topLevelElement);
@Override public DataContainerCodecContext<?,?> load(final QName qname) { final DataSchemaNode childSchema = getSchema().getDataChildByName(qname); childNonNull(childSchema, qname,"Argument %s is not valid child of %s", qname,getSchema()); if (childSchema instanceof DataNodeContainer || childSchema instanceof ChoiceSchemaNode) { @SuppressWarnings("unchecked") final Class<? extends DataObject> childCls = (Class<? extends DataObject>) factory().getRuntimeContext().getClassForSchema(childSchema); return streamChild(childCls); } throw new UnsupportedOperationException("Unsupported child type " + childSchema.getClass()); } });
if (it.hasNext()) { topLevelElement = it.next(); final DataSchemaNode dataChildByName = ctx.getDataChildByName(topLevelElement.getNodeType()); checkNotNull(dataChildByName, "Cannot find %s node in schema context. Instance identifier has to start from root", topLevelElement);
private DataContainerCodecContext<?, ?> createDataTreeChildContext(final Class<?> key) { final QName qname = BindingReflections.findQName(key); final DataSchemaNode childSchema = childNonNull(getSchema().getDataChildByName(qname), key, "%s is not top-level item.", key); return DataContainerCodecPrototype.from(key, childSchema, factory()).get(); }
DataContainerCodecContext<?,?> createDataTreeChildContext(final Class<?> key) { final QName qname = BindingReflections.findQName(key); final DataSchemaNode childSchema = childNonNull(getSchema().getDataChildByName(qname), key, "%s is not top-level item.", key); return DataContainerCodecPrototype.from(key, childSchema, factory()).get(); }
final QName next = iterator.next(); if (current == null) { dataChildByName = schemaContext.getDataChildByName(next); } else { dataChildByName = current.getDataChildByName(next);