@Override @SuppressWarnings("unchecked") final NormalizedNode<?, ?> create(final PathArgument first, final Iterator<PathArgument> others, final Optional<NormalizedNode<?, ?>> lastChild, final Optional<Entry<QName, ModifyAction>> operation) { 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); } } @SuppressWarnings("rawtypes") final NormalizedNodeContainerBuilder builder = createBuilder(first); if (others.hasNext()) { final PathArgument childPath = others.next(); final InstanceIdToNodes<?> childOp = getChildOperation(childPath); builder.addChild(childOp.create(childPath, others, lastChild, operation)); } else { if (lastChild.isPresent()) { builder.withValue(ImmutableList.copyOf((Collection<?>) lastChild.get().getValue())); } if (operation.isPresent()) { checkArgument(builder instanceof AttributesBuilder<?>); addModifyOpIfPresent(operation, (AttributesBuilder<?>) builder); } } return builder.build(); }
@Override @SuppressWarnings("unchecked") final NormalizedNode<?, ?> create(final PathArgument first, final Iterator<PathArgument> others, final Optional<NormalizedNode<?, ?>> lastChild, final Optional<Entry<QName, ModifyAction>> operation) { 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); } } @SuppressWarnings("rawtypes") final NormalizedNodeContainerBuilder builder = createBuilder(first); if (others.hasNext()) { final PathArgument childPath = others.next(); final InstanceIdToNodes<?> childOp = getChildOperation(childPath); builder.addChild(childOp.create(childPath, others, lastChild, operation)); } else { if (lastChild.isPresent()) { builder.withValue(ImmutableList.copyOf((Collection<?>) lastChild.get().getValue())); } if (operation.isPresent()) { checkArgument(builder instanceof AttributesBuilder<?>); addModifyOpIfPresent(operation, (AttributesBuilder<?>) builder); } } return builder.build(); }