@Test public void testGetAttributes() { Element parent = new Element("id"); String parentattribute = "a"; parent.setAttribute(parentattribute, 1); Element element = new Element(parent); String attribute = "b"; element.setAttribute(attribute, 1); Assert.assertTrue(element.getAttributes().isDefined(parentattribute)); Assert.assertTrue(element.getAttributes().isDefined(attribute)); }
@Override public Attributes getAttributes() { Attributes map = new Attributes(); if (parent != null) { map.putAll(parent.getAttributes()); } map.putAll(attributes.getAttributes()); return map; }
Element implements IAttributes { @Override public Attributes getAttributes() { Attributes map = new Attributes(); if (parent != null) { map.putAll(parent.getAttributes()); } map.putAll(attributes.getAttributes()); return map; } }
Element implements IAttributes { @Override public Attributes getAttributes() { Attributes map = new Attributes(); if (parent != null) { map.putAll(parent.getAttributes()); } map.putAll(attributes.getAttributes()); return map; } Element(String id);  Element(Element parent); }
Element implements IAttributes { @Override public Attributes getAttributes() { Attributes map = new Attributes(); if (parent != null) { map.putAll(parent.getAttributes()); } map.putAll(attributes.getAttributes()); return map; } Element(String id);  Element(Element parent); String getId(); Element getParent(); void setParent(Element element); @SuppressWarnings("unchecked") @Override O getAttribute(String identifier); @Override boolean isDefined(String identifier); @Override Attributes getAttributes(); Attributes getLocalAttributes(); Set<String> getLocalAttributeNames(); @Override void setAttribute(String identifier, Object object); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override Parameter getAttributeParameter(String identifier); @Override Set<String> getAttributeNames(); String getType(); void setType(String type); }
Element implements IAttributes { @Override public Attributes getAttributes() { Attributes map = new Attributes(); if (parent != null) { map.putAll(parent.getAttributes()); } map.putAll(attributes.getAttributes()); return map; } Element(String id);  Element(Element parent); String getId(); Element getParent(); void setParent(Element element); @SuppressWarnings("unchecked") @Override O getAttribute(String identifier); @Override boolean isDefined(String identifier); @Override Attributes getAttributes(); Attributes getLocalAttributes(); Set<String> getLocalAttributeNames(); @Override void setAttribute(String identifier, Object object); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override Parameter getAttributeParameter(String identifier); @Override Set<String> getAttributeNames(); String getType(); void setType(String type); static String TYPE; }