Installation
Maven coordinates for runtime use and for annotation processing.
ProxyBuilder ships a single artefact that contains both the runtime API and the annotation processors. Add it once for runtime use; for annotation processing add it to the compiler plugin’s processor path.
Runtime dependency
<dependency>
<groupId>com.svenruppert</groupId>
<artifactId>proxybuilder</artifactId>
<version>00.10.00</version>
</dependency>
This is enough if you only use DynamicProxyBuilder and friends from the
runtime API.
Annotation processing
To have @StaticLoggingProxy, @StaticMetricsProxy, @StaticVirtualProxy,
@StaticObjectAdapter or @DynamicObjectAdapterBuilder actually generate
classes, register the artefact on the compiler plugin’s annotation processor
path:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>com.svenruppert</groupId>
<artifactId>proxybuilder</artifactId>
<version>00.10.00</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Processor options
The base processor recognises three compiler arguments:
-Aproxybuilder.verbose— reserved for verbose notes.-Aproxybuilder.suffix=<Suffix>— override the generated class suffix.-Aproxybuilder.failOnStaticMethods=true|false— defaults totrue. Set tofalseto downgrade the “static method on a proxy target” finding to a compiler warning.
Wire them in via <compilerArgs>:
<compilerArgs>
<arg>-Aproxybuilder.suffix=Secured</arg>
<arg>-Aproxybuilder.failOnStaticMethods=true</arg>
</compilerArgs>
See Processor options for the full list and the reasoning behind each.
JPMS
ProxyBuilder is a JPMS module:
module com.svenruppert.proxybuilder
If your project uses module-info.java, add:
requires com.svenruppert.proxybuilder;
See the JPMS module reference for the transitive requires and
the jdeps validation command.