PsiMethod (@NotNull PsiClass psiClass, @NotNull String methodName, @NotNull PsiType returnType, PsiType... params) { final PsiMethod[] toStringMethods = psiClass.findMethodsByName(methodName, false); for (PsiMethod method : toStringMethods) { if (method.hasModifierProperty(PsiModifier.PUBLIC) && !method.hasModifierProperty(PsiModifier.STATIC) && returnType.equals(method.getReturnType())) { final PsiParameterList parameterList = method.getParameterList(); final PsiParameter[] psiParameters = parameterList.getParameters(); final int paramsCount = params.length; if (psiParameters.length == paramsCount) { boolean allParametersFound = true; for (int i = 0; i < paramsCount; i++) { if (!psiParameters[i].getType().equals(params[i])) { allParametersFound = false; break; } } if (allParametersFound) { return method; } } } } return null; }