2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
10 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
11 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
12 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
13 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
15 public final class ImmutableLeafNodeSchemaAwareBuilder<T> extends ImmutableLeafNodeBuilder<T> {
17 private final LeafSchemaNode schema;
19 private ImmutableLeafNodeSchemaAwareBuilder(LeafSchemaNode schema) {
22 super.withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(schema.getQName()));
25 public static <T> NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, T, LeafNode<T>> create(LeafSchemaNode schema) {
26 return new ImmutableLeafNodeSchemaAwareBuilder<>(schema);
30 public NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, T, LeafNode<T>> withValue(T value) {
31 // TODO check value type
32 return super.withValue(value);
36 public NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, T, LeafNode<T>> withNodeIdentifier(InstanceIdentifier.NodeIdentifier nodeIdentifier) {
37 throw new UnsupportedOperationException("Node identifier created from schema");