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 org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
17 import com.google.common.base.MoreObjects.ToStringHelper;
19 // FIXME: are attributes part of hashCode/equals?
20 public abstract class AbstractImmutableDataContainerAttrNode<K extends YangInstanceIdentifier.PathArgument>
21 extends AbstractImmutableDataContainerNode<K>
22 implements AttributesContainer {
24 private final Map<QName, String> attributes;
26 public AbstractImmutableDataContainerAttrNode(
27 final Map<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> children,
28 final K nodeIdentifier, final Map<QName, String> attributes) {
29 super(children, nodeIdentifier);
30 this.attributes = attributes;
34 public final Map<QName, String> getAttributes() {
39 public final Object getAttributeValue(final QName value) {
40 return attributes.get(value);
44 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
45 return super.addToStringAttributes(toStringHelper).add("attributes", attributes);