org.refactoringminer.api.RefactoringHandler 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.util.List;
/**
* Handler object that works in conjunction with {@link org.refactoringminer.api.GitHistoryRefactoringMiner}.
*
*/
public abstract class RefactoringHandler {
/**
* Indicate commits that should be ignored.
* You may override this method to implement custom logic.
*
* @param commitId The SHA key that identifies the commit.
* @return True to skip the commit, false otherwise.
*/
public boolean skipCommit(String commitId) {
return false;
}
/**
* This method is called after each commit is analyzed.
* You should override this method to do your custom logic with the list of detected refactorings.
*
* @param commitId The sha of the analyzed commit.
* @param refactorings List of refactorings detected in the commit.
*/
public void handle(String commitId, List refactorings) {}
/**
* This method is called whenever an exception is thrown during the analysis of the given commit.
* You should override this method to do your custom logic in the case of exceptions (e.g. skip or rethrow).
*
* @param commitId The SHA key that identifies the commit.
* @param e The exception thrown.
*/
public void handleException(String commitId, Exception e) {
throw new RuntimeException(e);
}
/**
* This method is called after all commits are analyzed.
* You may override this method to implement custom logic.
*
* @param refactoringsCount Total number of refactorings detected.
* @param commitsCount Total number of commits analyzed.
* @param errorCommitsCount Total number of commits not analyzed due to errors.
*/
public void onFinish(int refactoringsCount, int commitsCount, int errorCommitsCount) {}
}