コード例 #1
0
 @Override
 public InstanceIdToNodes<?> getChild(final PathArgument child) {
   if (child.getNodeType().equals(getIdentifier().getNodeType())) {
     return innerNode;
   }
   return null;
 }
コード例 #2
0
 private InstanceIdToNodes<?> fromLocalSchema(final PathArgument child) {
   if (child instanceof AugmentationIdentifier) {
     return fromSchemaAndQNameChecked(
         schema, ((AugmentationIdentifier) child).getPossibleChildNames().iterator().next());
   }
   return fromSchemaAndQNameChecked(schema, child.getNodeType());
 }
コード例 #3
0
  @Override
  @SuppressWarnings("unchecked")
  public final NormalizedNode<?, ?> create(
      final YangInstanceIdentifier instanceId,
      final Optional<NormalizedNode<?, ?>> lastChild,
      final Optional<Map.Entry<QName, ModifyAction>> operation) {
    checkNotNull(instanceId);
    final Iterator<PathArgument> iterator = instanceId.getPathArguments().iterator();
    final PathArgument legacyData = iterator.next();

    if (!isMixin() && 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 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));
      }
    }

    return builder.build();
  }