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 static java.util.Objects.requireNonNull;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
13 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
14 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder;
15 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
17 public final class ImmutableLeafSetEntryNodeSchemaAwareBuilder<T> extends ImmutableLeafSetEntryNodeBuilder<T> {
19 private final LeafListSchemaNode schema;
21 private ImmutableLeafSetEntryNodeSchemaAwareBuilder(final LeafListSchemaNode schema) {
22 this.schema = requireNonNull(schema);
25 public static <T> NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> create(
26 final LeafListSchemaNode schema) {
27 return new ImmutableLeafSetEntryNodeSchemaAwareBuilder<>(schema);
31 public NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> withValue(final T withValue) {
32 super.withNodeIdentifier(new NodeWithValue<>(schema.getQName(), withValue));
33 // TODO check value type using TypeProvider ?
34 return super.withValue(withValue);
38 public NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> withNodeIdentifier(
39 final NodeWithValue withNodeIdentifier) {
40 throw new UnsupportedOperationException("Node identifier created from schema");