2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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 com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.AnydataNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
17 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableNormalizedSimpleValueNode;
20 public class ImmutableAnydataNodeBuilder<V>
21 extends AbstractImmutableNormalizedNodeBuilder<NodeIdentifier, V, AnydataNode<V>> {
22 private final @NonNull Class<V> objectModel;
24 ImmutableAnydataNodeBuilder(final Class<V> objectModel) {
25 this.objectModel = requireNonNull(objectModel);
28 public static <V> NormalizedNodeBuilder<NodeIdentifier, V, AnydataNode<V>> create(final Class<V> objectModel) {
29 return new ImmutableAnydataNodeBuilder<>(objectModel);
33 public AnydataNode<V> build() {
34 return new ImmutableAnydataNode<>(getNodeIdentifier(), getValue(), objectModel);
37 private static final class ImmutableAnydataNode<V>
38 extends AbstractImmutableNormalizedSimpleValueNode<NodeIdentifier, AnydataNode<?>, V>
39 implements AnydataNode<V> {
40 private final Class<V> objectModel;
42 protected ImmutableAnydataNode(final NodeIdentifier nodeIdentifier, final V value, final Class<V> objectModel) {
43 super(nodeIdentifier, value);
44 this.objectModel = requireNonNull(objectModel);
48 public Class<V> bodyObjectModel() {
53 protected Class<AnydataNode<?>> implementedType() {
54 return (Class) AnydataNode.class;