propertiesMapping.setAttributeName("properties");
propertiesMapping.setReferenceClass(PropertyAssociation.class);
propertiesMapping.setAttributeAccessor(new AttributeAccessor() {
public Object getAttributeValueFromObject(Object object) {
DatabaseMapping mapping = (DatabaseMapping)object;
Vector propertyAssociations = new NonSynchronizedVector();
for (Iterator i = mapping.getProperties().entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry)i.next();
PropertyAssociation propertyAssociation = new PropertyAssociation();
propertyAssociation.setKey(me.getKey());
propertyAssociation.setValue(me.getValue());
propertyAssociations.add(propertyAssociation);
}
return propertyAssociations;
}
public void setAttributeValueInObject(Object object, Object value) {
DatabaseMapping mapping = (DatabaseMapping)object;
Vector propertyAssociations = (Vector)value;
for (int i = 0; i < propertyAssociations.size(); i++) {
PropertyAssociation propertyAssociation = (PropertyAssociation)propertyAssociations.get(i);
mapping.getProperties().put(propertyAssociation.getKey(), propertyAssociation.getValue());
}
}
});
propertiesMapping.setXPath(getSecondaryNamespaceXPath() + "properties/" + getSecondaryNamespaceXPath() + "property");