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.nodes;
12 import com.google.common.collect.ImmutableSet;
13 import org.opendaylight.yangtools.concepts.Immutable;
14 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
16 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
18 import com.google.common.base.Optional;
19 import com.google.common.collect.ImmutableList;
21 public abstract class AbstractImmutableDataContainerNode<K extends PathArgument> //
22 extends AbstractImmutableNormalizedNode<K, Iterable<DataContainerChild<? extends PathArgument, ?>>> //
23 implements Immutable, DataContainerNode<K> {
25 protected final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children;
28 public AbstractImmutableDataContainerNode(
29 final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children, final K nodeIdentifier) {
30 super(nodeIdentifier, ImmutableSet.copyOf(children.values()));
31 this.children = children;
35 public final Optional<DataContainerChild<? extends PathArgument, ?>> getChild(final PathArgument child) {
36 return Optional.<DataContainerChild<? extends PathArgument, ?>> fromNullable(children.get(child));