org.refactoringminer.api.Refactoring 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 org.refactoringminer.api;
import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang3.tuple.ImmutablePair;
import com.fasterxml.jackson.core.io.JsonStringEncoder;
import com.fasterxml.jackson.core.util.BufferRecyclers;
public interface Refactoring extends Serializable, CodeRangeProvider {
public RefactoringType getRefactoringType();
public String getName();
public String toString();
/**
* @return a Set of ImmutablePair where left is the file path of a program element, and right is the qualified name of the class containing the program element
*/
public Set> getInvolvedClassesBeforeRefactoring();
/**
* @return a Set of ImmutablePair where left is the file path of a program element, and right is the qualified name of the class containing the program element
*/
public Set> getInvolvedClassesAfterRefactoring();
default public String toJSON() {
StringBuilder sb = new StringBuilder();
JsonStringEncoder encoder = BufferRecyclers.getJsonStringEncoder();
sb.append("{").append("\n");
sb.append("\t").append("\"").append("type").append("\"").append(": ").append("\"").append(getName()).append("\"").append(",").append("\n");
sb.append("\t").append("\"").append("description").append("\"").append(": ").append("\"");
encoder.quoteAsString(toString().replace('\t', ' '), sb);
sb.append("\"").append(",").append("\n");
sb.append("\t").append("\"").append("leftSideLocations").append("\"").append(": ").append(leftSide()).append(",").append("\n");
sb.append("\t").append("\"").append("rightSideLocations").append("\"").append(": ").append(rightSide()).append("\n");
sb.append("}");
return sb.toString();
}
}