@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; }
public JavaClassCollection( JavaClassRelationTypes javaClassRelationTypes, Collection<JavaClass> javaClasses) { super(); this.javaClassRelationTypes = javaClassRelationTypes; this.javaClasses = javaClasses; javaClassesForId = new HashMap<String, JavaClass>(); javaClassesForName = new HashMap<String, JavaClass>(); for (JavaClass javaClass : javaClasses) { javaClassesForId.put(javaClass.getId(), javaClass); javaClassesForName.put(javaClass.getName(), javaClass); } unitJavaClasses = unitTheadClassCollection(javaClasses); }