Skip to content

Code generation

View Markdown

Vertique’s annotation processors turn annotations into Dagger modules and proxies, which keeps wiring explicit and surfaces mistakes at compile time.

  • Annotations in, modules out. Each processor scans your annotated classes and emits a generated Dagger module or proxy. You install the generated module in your component and do not hand-write its bindings.
  • Failures move to the build. Processors emit diagnostics attributed to your own source elements. A malformed contract, an invalid cron expression, or a duplicate id fails compilation, so it does not reach the running process.
  • No reflection at runtime. Generated execution plans, proxies, and annotation literals mean nothing scans the classpath or reads annotations while requests are being served.
  • Nothing is wired invisibly. Generated modules are named in your own component like any other module, and generated sources land under target/generated-sources/annotations where you can read them.
  • One facade, no processor bookkeeping. Applications parented on vertique-app-parent run the complete processor facade automatically. Custom-parent applications add the BOM plus the vertique-codegen-all recipe once.
You write The processor generates Covered on
@VertiqueApp on your component The component factory the launcher discovers Application model
@Path resource classes GeneratedJaxRsResourcesModule plus a per-method execution plan and descriptor REST APIs
@ServiceContract interfaces and implementations GeneratedServicesModule: implementation registration, injectable client bindings, and a contract contributor per service Services
@WorkflowContract interfaces Typed workflow client proxies and GeneratedWorkflowClientsModule Workflows
@DelayedJobContract interfaces A static client proxy. The client binding itself is a hand-written provider Jobs
@CronJob methods Nothing. This processor validates: cron expressions, policy values, duplicate ids, and service coupling fail the build Jobs
@KafkaSource methods and @KafkaListener handler classes GeneratedKafkaConsumersModule consumer contributions (routing interfaces stay manual) Kafka
@RegisterAs and @RegisterIntoSet on injectable concrete classes GeneratedRegistrationsModule with direct @Binds and set @Binds @IntoSet declarations Dependency injection
@Aspect-meta-annotated annotations on bean methods, including @Resilient, @Cacheable, @CacheEvict, @RateLimited, and @Timed A subclass proxy per bean and a generated module binding each bean to its proxy AOP and events
@Resilient and its resilience declarations Compile-time validation of anchors, placements, policy names, value bounds, and proxyability. This processor generates no sources Services
@Observes observer methods and typed event publishers Publisher implementations and observer registrations in a generated events module AOP and events

Each page above shows its family’s generated artifact in use, and this table is an index to those pages.

@NoAutoWire on a resource class opts it out of JAX-RS generation and keeps a hand-written binding canonical. Use it when a resource must be constructed in a way the processor cannot express. Every generated artifact is ordinary Java under target/generated-sources/annotations, so you can always read the generated module, proxy, or plan to see what the processor did. That source is what the compiler saw.

There is no processor list to maintain. vertique-app-parent configures the Maven compiler with the Dagger annotation processor plus the complete Vertique processor facade, and every family in the table activates when its annotations appear in your source. A custom-parent application imports the BOM and follows the vertique-codegen-all recipe. Each capability’s module reference states which generated module to install in the component.

Resilience uses two compile-time responsibilities: vertique-codegen-resilience validates the resilience vocabulary and the concrete-bean anchor rules, while vertique-codegen-aop generates the proxy because @Resilient is itself an @Aspect trigger. The validation processor emits no classes of its own. The generated AOP module is the binding that makes the proxy injectable.