68024d6ea292dc1c7635139dded6dc9e29f3a605
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / nodes / AbstractImmutableDataContainerAttrNode.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.impl.schema.nodes;
9
10 import java.util.Map;
11
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
14 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
16
17 public abstract class AbstractImmutableDataContainerAttrNode<K extends InstanceIdentifier.PathArgument>
18         extends AbstractImmutableDataContainerNode<K>
19     implements AttributesContainer {
20
21     private final Map<QName, String> attributes;
22
23     public AbstractImmutableDataContainerAttrNode(
24             Map<InstanceIdentifier.PathArgument, DataContainerChild<? extends InstanceIdentifier.PathArgument, ?>> children,
25             K nodeIdentifier, Map<QName, String> attributes) {
26         super(children, nodeIdentifier);
27         this.attributes = attributes;
28     }
29
30     @Override
31     public final Map<QName, String> getAttributes() {
32         return attributes;
33     }
34
35     @Override
36     public final Object getAttributeValue(QName value) {
37         return attributes.get(value);
38     }
39 }