AssociationValue implements Serializable { public Object getAttributeValue(String attributeName) { Attribute attribute = getAllAttributes().get(attributeName); if (attribute != null) { return attribute.getValue(); } return null; } AssociationValue(); @SuppressWarnings({ "unchecked", "rawtypes" })  AssociationValue(PrimitiveAttribute<?> id, Map<String, PrimitiveAttribute<?>> attributes);  AssociationValue(PrimitiveAttribute<?> id, Map<String, Attribute<?>> attributes, boolean primitiveOnly); @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "CN_IDIOM_NO_SUPER_CALL", justification = "needed for GWT") Object clone(); PrimitiveAttribute<?> getId(); void setId(PrimitiveAttribute<?> id); @Deprecated @SuppressWarnings({ "rawtypes", "unchecked" }) Map<String, PrimitiveAttribute<?>> getAttributes(); @Deprecated @SuppressWarnings({ "rawtypes", "unchecked" }) void setAttributes(Map<String, PrimitiveAttribute<?>> attributes); Map<String, Attribute<?>> getAllAttributes(); void setAllAttributes(Map<String, Attribute<?>> attributes); Object getAttributeValue(String attributeName); boolean isPrimitiveOnly(); void setPrimitiveOnly(boolean primitiveOnly); void setBooleanAttribute(String name, Boolean value); void setCurrencyAttribute(String name, String value); void setDateAttribute(String name, Date value); void setDoubleAttribute(String name, Double value); void setFloatAttribute(String name, Float value); void setImageUrlAttribute(String name, String value); void setIntegerAttribute(String name, Integer value); void setLongAttribute(String name, Long value); void setShortAttribute(String name, Short value); void setStringAttribute(String name, String value); void setUrlAttribute(String name, String value); void setManyToOneAttribute(String name, AssociationValue value); @Override String toString();  }
@Test public void testGetAttributeValue() { Map<String, Attribute<?>> attrs = new HashMap<String, Attribute<?>>(); attrs.put("string", new StringAttribute("s1")); attrs.put("boolean", new BooleanAttribute(true)); attrs.put("long", new LongAttribute(5L)); AssociationValue value = new AssociationValue(new StringAttribute("1"), attrs, true); Assert.assertEquals("s1", value.getAttributeValue("string")); Assert.assertEquals(Boolean.TRUE, value.getAttributeValue("boolean")); Assert.assertEquals(new Long(5), value.getAttributeValue("long")); Assert.assertEquals(null, value.getAttributeValue("missing")); }