Пример #1
0
  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);
    }
  }
Пример #2
0
  public void removeClasses(ClassCollection collection, DeltaModule deltaToApply) {

    List<String> classesToRemove = DeltaJUtils.getClassesToRemove(deltaToApply);
    for (String classToRemove : classesToRemove) {
      removeClassByName(collection, classToRemove);
    }
  }
Пример #3
0
  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;
  }
Пример #4
0
  protected Method removeMethod(Class classToModify, String methodName) {

    Method methodToRemove = DeltaJUtils.methodByName(classToModify, methodName);
    if (methodToRemove != null) classToModify.getMethods().remove(methodToRemove);
    return methodToRemove;
  }
Пример #5
0
  protected void modifyClassCase(Class classToModify, FieldRemoval removesField) {

    Field fieldToRemove = DeltaJUtils.fieldByName(classToModify, removesField.getName());
    if (fieldToRemove != null) classToModify.getFields().remove(fieldToRemove);
  }