{
if (propertyValue == null)
{
// Search in properties to erase
Iterator<AbstractField> it = getContainer().getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext())
{
tmp = it.next();
if (tmp.getPropertyName().equals(qualifiedName))
{
getContainer().removeProperty(tmp);
return;
}
}
}
else
{
AbstractSimpleProperty specifiedTypeProperty;
try
{
TypeMapping tm = getMetadata().getTypeMapping();
specifiedTypeProperty = tm.instanciateSimpleProperty(null, getPrefix(), qualifiedName, propertyValue,
type);
}
catch (Exception e)
{
throw new IllegalArgumentException(
"Failed to create property with the specified type given in parameters", e);
}
// attribute placement for simple property has been removed
// Search in properties to erase
Iterator<AbstractField> it = getAllProperties().iterator();
AbstractField tmp;
while (it.hasNext())
{
tmp = it.next();
if (tmp.getPropertyName().equals(qualifiedName))
{
removeProperty(tmp);
addProperty(specifiedTypeProperty);
return;
}