- public final NormalizedNode<?, ?> create(final YangInstanceIdentifier instanceId, final Optional<NormalizedNode<?, ?>> lastChild, final Optional<Map.Entry<QName,ModifyAction>> operation) {
- checkNotNull(instanceId);
- final Iterator<YangInstanceIdentifier.PathArgument> iterator = instanceId.getPathArguments().iterator();
- final YangInstanceIdentifier.PathArgument legacyData = iterator.next();
-
- if (!isMixin(this) && getIdentifier().getNodeType() != null) {
- checkArgument(getIdentifier().getNodeType().equals(legacyData.getNodeType()),
- "Node QName must be %s was %s", getIdentifier().getNodeType(), legacyData.getNodeType());
- }
- final NormalizedNodeContainerBuilder builder = createBuilder(legacyData);
-
- if (iterator.hasNext()) {
- final YangInstanceIdentifier.PathArgument childPath = iterator.next();
- final InstanceIdToNodes childOp = getChildOperation(childPath);
-
- final YangInstanceIdentifier childId = YangInstanceIdentifier.create(Iterables.skip(instanceId.getPathArguments(), 1));
- builder.addChild(childOp.create(childId, lastChild, operation));
- } else {
- if(lastChild.isPresent()) {
- builder.withValue(Lists.newArrayList((Collection<?>) lastChild.get().getValue()));
- }
- if(operation.isPresent()) {
- Preconditions.checkArgument(builder instanceof AttributesBuilder<?>);
- addModifyOpIfPresent(operation, ((AttributesBuilder<?>) builder));
+ final NormalizedNode<?, ?> create(final PathArgument first, final Iterator<PathArgument> others,
+ final Optional<NormalizedNode<?, ?>> lastChild) {
+ if (!isMixin()) {
+ final QName type = getIdentifier().getNodeType();
+ if (type != null) {
+ final QName firstType = first.getNodeType();
+ checkArgument(type.equals(firstType), "Node QName must be %s was %s", type, firstType);