Skip to content

Commit

Permalink
Let the generator claims the annotations it needs
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Nov 21, 2018
1 parent 25b4129 commit 2f0599a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
20 changes: 19 additions & 1 deletion vertx-web-api-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<id>default-jar</id>
<configuration>
<excludes>
<exclude>META-INF/javax.annotation.processing.Processor</exclude>
<exclude>META-INF/services/javax.annotation.processing.Processor</exclude>
<exclude>examples/**</exclude>
</excludes>
</configuration>
Expand All @@ -117,6 +117,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>generate-sources</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<!-- Don't run it on this project as it's a generator -->
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package io.vertx.ext.web.api.generator.impl;

import io.vertx.codegen.ParamInfo;
import io.vertx.codegen.annotations.ModuleGen;
import io.vertx.codegen.type.*;
import io.vertx.ext.web.api.RequestParameter;
import io.vertx.ext.web.api.generator.WebApiServiceGen;
import io.vertx.ext.web.api.generator.impl.model.WebApiProxyMethodInfo;
import io.vertx.codegen.writer.CodeWriter;
import io.vertx.serviceproxy.generator.GeneratorUtils;
import io.vertx.serviceproxy.generator.ServiceProxyHandlerGen;
import io.vertx.serviceproxy.generator.model.ProxyMethodInfo;
import io.vertx.serviceproxy.generator.model.ProxyModel;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -28,6 +33,11 @@ public WebApiProxyHandlerGen(GeneratorUtils utils) {
serviceCallHandler = utils.loadResource("service_call_handler", "vertx-web-api-contract-codegen");
}

@Override
public Collection<Class<? extends Annotation>> annotations() {
return Arrays.asList(WebApiServiceGen.class, ModuleGen.class);
}

public String className(ProxyModel model) {
return model.getIfaceSimpleName() + "VertxProxyHandler";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public WebApiServiceProxyGenerator() { }
private static final Predicate<Generator> FILTER = generator ->
generator.name.contains("web_api_service_proxy_handler") || generator.name.equals("data_object_converters");

@Override
protected Predicate<Generator> filterGenerators() {
return FILTER;
}

@Override
public Set<String> getSupportedAnnotationTypes() {
return Arrays.asList(
Expand Down

0 comments on commit 2f0599a

Please sign in to comment.