How to remove attribute from owner in modelio?
Here is my code;
EList<Attribute> attributeList = classifier.getOwnedAttribute();
attributeList.removeAll(attributeList);
How to remove attribute from owner in modelio?
Here is my code;
EList<Attribute> attributeList = classifier.getOwnedAttribute();
attributeList.removeAll(attributeList);
Hello, Your code only detach the attributes from their owner, it does not delete them.
To delete one of them, use:
classifier.getOwnedAttribute().get(0).delete();
If you want to delete all of them, use :
List<Attribute> attributeList = classifier.getOwnedAttribute();
while (! attributeList.isEmpty()) {
attributeList.get(0).delete();
}
Do not write:
for (Attribute a : classifier.getOwnedAttribute()) {
a.delete(); // <== ConcurrentModificationException on second execution
}
You may write instead:
for (Attribute a : new ArrayList<>(classifier.getOwnedAttribute())) {
a.delete(); // works
}
but it is less efficient than the first solution.