public void modifyClasses(ClassCollection collection, DeltaModule delta) { List<ClassModification> modifiesClasses = DeltaJUtils.getDeltaModifies(delta); for (ClassModification modifiesClass : modifiesClasses) { Class classToModify = DeltaJUtils.classByName(collection, modifiesClass.getName()); if (classToModify != null) modifyClass(classToModify, modifiesClass); } }
public void removeClasses(ClassCollection collection, DeltaModule deltaToApply) { List<String> classesToRemove = DeltaJUtils.getClassesToRemove(deltaToApply); for (String classToRemove : classesToRemove) { removeClassByName(collection, classToRemove); } }
public List<Class> getCopyOfAddedClasses(DeltaModule delta) { List<Class> addedClasses = DeltaJUtils.getAddedClasses(delta); List<Class> copy = new LinkedList<Class>(); for (Class class1 : addedClasses) { copy.add(EcoreUtil2.clone(class1)); } return copy; }
protected Method removeMethod(Class classToModify, String methodName) { Method methodToRemove = DeltaJUtils.methodByName(classToModify, methodName); if (methodToRemove != null) classToModify.getMethods().remove(methodToRemove); return methodToRemove; }
protected void modifyClassCase(Class classToModify, FieldRemoval removesField) { Field fieldToRemove = DeltaJUtils.fieldByName(classToModify, removesField.getName()); if (fieldToRemove != null) classToModify.getFields().remove(fieldToRemove); }