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 com.google.common.base.Preconditions;
11 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
12 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
13 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder;
14 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
16 public final class ImmutableLeafSetEntryNodeSchemaAwareBuilder<T> extends ImmutableLeafSetEntryNodeBuilder<T> {
18 private final LeafListSchemaNode schema;
20 private ImmutableLeafSetEntryNodeSchemaAwareBuilder(final LeafListSchemaNode schema) {
21 this.schema = Preconditions.checkNotNull(schema);
24 public static <T> NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> create(
25 final LeafListSchemaNode schema) {
26 return new ImmutableLeafSetEntryNodeSchemaAwareBuilder<>(schema);
30 public NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> withValue(final T value) {
31 super.withNodeIdentifier(new NodeWithValue<>(schema.getQName(), value));
32 // TODO check value type using TypeProvider ?
33 return super.withValue(value);
37 public NormalizedNodeAttrBuilder<NodeWithValue, T, LeafSetEntryNode<T>> withNodeIdentifier(
38 final NodeWithValue nodeIdentifier) {
39 throw new UnsupportedOperationException("Node identifier created from schema");