void (String methodName, String migrationType) { start(new RulesProvider() { @Override public PsiType migrationType(PsiElement context) { return myFactory.createTypeFromText(migrationType, context); } @Override public PsiElement victim(PsiClass aClass) { for (PsiMethod method : PsiTreeUtil.findChildrenOfType(aClass, PsiMethod.class)) { if (methodName.equals(method.getName())) { return method; } } throw new AssertionError(); } }); }