AnnotatedDocServicePlugin implements DocServicePlugin { @Override public ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConfigs, DocServiceFilter filter) { requireNonNull(serviceConfigs, "serviceConfigs"); requireNonNull(filter, "filter"); final Map<Class<?>, Set<MethodInfo>> methodInfos = new HashMap<>(); final Map<Class<?>, String> serviceDescription = new HashMap<>(); serviceConfigs.forEach(sc -> { final AnnotatedService service = sc.service().as(AnnotatedService.class); if (service != null) { final String className = service.object().getClass().getName(); final String methodName = service.method().getName(); if (!filter.test(name(), className, methodName)) { return; } addMethodInfo(methodInfos, sc.virtualHost().hostnamePattern(), service); addServiceDescription(serviceDescription, service); } }); return generate(serviceDescription, methodInfos); }  @Override String name(); @Override Set<Class<? extends Service<?, ?>>> supportedServiceTypes(); @Override ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConfigs,
                                                      DocServiceFilter filter); @Override Set<Class<?>> supportedExampleRequestTypes(); @Override @Nullable String serializeExampleRequest(String serviceName, String methodName,
                                          Object exampleRequest);  }
@Test void testGenerateSpecification() { final Map<String, ServiceInfo> services = services((plugin, service, method) -> true, (plugin, service, method) -> false, new FooClass(), new BarClass()); assertThat(services).containsOnlyKeys(FOO_NAME, BAR_NAME); checkFooService(services.get(FOO_NAME)); checkBarService(services.get(BAR_NAME)); }