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.rfc8528.data.util;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.base.MoreObjects.ToStringHelper;
14 import java.util.Collection;
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.opendaylight.yangtools.concepts.AbstractIdentifiable;
17 import org.opendaylight.yangtools.concepts.Immutable;
18 import org.opendaylight.yangtools.concepts.PrettyTree;
19 import org.opendaylight.yangtools.rfc8528.data.api.MountPointIdentifier;
20 import org.opendaylight.yangtools.rfc8528.data.api.MountPointNode;
21 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
22 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
23 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
24 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContext;
25 import org.opendaylight.yangtools.yang.data.spi.node.NormalizedNodePrettyTree;
28 public final class ImmutableMountPointNode extends AbstractIdentifiable<PathArgument, MountPointIdentifier>
29 implements MountPointNode, Immutable {
30 private final @NonNull MountPointContext mountCtx;
31 private final @NonNull ContainerNode delegate;
33 ImmutableMountPointNode(final @NonNull MountPointIdentifier identifier,
34 final @NonNull MountPointContext mountCtx, final @NonNull ContainerNode delegate) {
36 this.mountCtx = requireNonNull(mountCtx);
37 this.delegate = requireNonNull(delegate);
40 public static @NonNull ImmutableMountPointNode of(final @NonNull MountPointIdentifier identifier,
41 final @NonNull MountPointContext mountCtx, final @NonNull ContainerNode delegate) {
42 return new ImmutableMountPointNode(identifier, mountCtx, delegate);
46 public MountPointContext getMountPointContext() {
51 public Collection<DataContainerChild> body() {
52 return delegate.body();
56 public DataContainerChild childByArg(final PathArgument child) {
57 return delegate.childByArg(child);
61 public PrettyTree prettyTree() {
62 return new NormalizedNodePrettyTree(this);
66 protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
67 return super.addToStringAttributes(helper).add("delegate", delegate);