@Override protected boolean have(FeatureCheckContext context) { if (context.getAbstractMethods() != null && context.getSubClasses() != null) { for (Method abstractMethod : context.getAbstractMethods()) { if (abstractMethod.isProtected()) { // 存在public的调用抽象方法的方法 for (Method publicMethod : context.getCurrent().getSelfMethods()) { if (!publicMethod.isAbstract() && publicMethod.isPublic() && !publicMethod.isConstruction()) { for (InvokeItem item : publicMethod.getInvokeItems()) { if (item.getCallee().equals(abstractMethod)) { // 子类覆盖了抽象方法 for (JavaClass subClass : context.getSubClasses()) { if (subClass.getOverridedMethods().contains(abstractMethod)) { this.setPatternInfo(publicMethod.getName()); return true; } } } } } } } } } return false; }
public synchronized Map<String, Method> getHttpMethod() { if (this.httpMethods == null) { this.httpMethods = new HashMap<String, Method>(); for (JavaClass javaClass : javaClasses) { if (javaClass.getDetail().getRequestMapping() != null) { for (Method method : javaClass.getSelfMethods()) { if (method.getRequestMapping() != null) { this.httpMethods.put(method.getRequestMappingValueNoVariable(), method); } } } } } return this.httpMethods; }