gr.uom.java.xmi.diff.PullUpAttributeRefactoring Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refactoring-miner Show documentation
Show all versions of refactoring-miner Show documentation
RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.
package gr.uom.java.xmi.diff;
import java.util.ArrayList;
import java.util.List;
import org.refactoringminer.api.RefactoringType;
import gr.uom.java.xmi.UMLAttribute;
public class PullUpAttributeRefactoring extends MoveAttributeRefactoring {
public PullUpAttributeRefactoring(UMLAttribute originalAttribute, UMLAttribute movedAttribute) {
super(originalAttribute, movedAttribute);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getName()).append("\t");
sb.append(getOriginalAttribute().toQualifiedString());
sb.append(" from class ");
sb.append(getSourceClassName());
sb.append(" to ");
sb.append(getMovedAttribute().toQualifiedString());
sb.append(" from class ");
sb.append(getTargetClassName());
return sb.toString();
}
public RefactoringType getRefactoringType() {
return RefactoringType.PULL_UP_ATTRIBUTE;
}
@Override
public List rightSide() {
List ranges = new ArrayList();
ranges.add(movedAttribute.codeRange()
.setDescription("pulled up attribute declaration")
.setCodeElement(movedAttribute.toString()));
return ranges;
}
}