import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import com.google.common.base.Objects.ToStringHelper;
+
public abstract class AbstractImmutableDataContainerAttrNode<K extends InstanceIdentifier.PathArgument>
extends AbstractImmutableDataContainerNode<K>
implements AttributesContainer {
private final Map<QName, String> attributes;
public AbstractImmutableDataContainerAttrNode(
- Map<InstanceIdentifier.PathArgument, DataContainerChild<? extends InstanceIdentifier.PathArgument, ?>> children,
- K nodeIdentifier, Map<QName, String> attributes) {
+ final Map<InstanceIdentifier.PathArgument, DataContainerChild<? extends InstanceIdentifier.PathArgument, ?>> children,
+ final K nodeIdentifier, final Map<QName, String> attributes) {
super(children, nodeIdentifier);
this.attributes = attributes;
}
}
@Override
- public final Object getAttributeValue(QName value) {
+ public final Object getAttributeValue(final QName value) {
return attributes.get(value);
}
+
+ @Override
+ protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
+ return super.addToStringAttributes(toStringHelper).add("attributes", attributes);
+ }
+
+// FIXME: are attributes part of hashCode/equals?
+// @Override
+// protected int valueHashCode() {
+// int result = super.valueHashCode();
+// for (final Entry<?, ?> a : attributes.entrySet()) {
+// result = 31 * result + a.hashCode();
+// }
+// return result;
+// }
+
+ // FIXME: are attributes part of hashCode/equals?
+// @Override
+// protected boolean valueEquals(final NormalizedNode<?, ?> other) {
+// if (!super.valueEquals(other)) {
+// return false;
+// }
+// final Set<Entry<QName, String>> tas = getAttributes().entrySet();
+// final Set<Entry<QName, String>> oas = container.getAttributes().entrySet();
+//
+// return tas.containsAll(oas) && oas.containsAll(tas);
+// return true;
+// }
}