Skip to content

Processor configuration

Most projects can start without explicit processor configuration. Add a configuration type when you want shared defaults, shared converters, or stable configuration across Maven modules.

Create a class or pure configuration interface annotated with @JdbcConfig. Use it for defaults that should apply to the current annotation-processing run.

import io.kaumei.jdbc.annotation.config.JdbcBatchSize;
import io.kaumei.jdbc.annotation.config.JdbcConfig;
import io.kaumei.jdbc.annotation.config.JdbcQueryTimeout;
@JdbcConfig
@JdbcBatchSize(500)
@JdbcQueryTimeout(10)
interface JdbcProcessorConfig {
}

Select the configuration type with the annotation processor option io.kaumei.jdbc.processor.config.

Pass processor options through the Maven compiler plugin.

<compilerArgs>
<arg>-Aio.kaumei.jdbc.processor.config=com.example.JdbcProcessorConfig</arg>
<arg>-Aio.kaumei.jdbc.processor.debugfolder=target/kaumei-jdbc-debug</arg>
<arg>-Aio.kaumei.jdbc.processor.loglevel=ERROR</arg>
</compilerArgs>

Use io.kaumei.jdbc.processor.config for the selected @JdbcConfig type. Use io.kaumei.jdbc.processor.debugfolder only when you need processor debug output. Use io.kaumei.jdbc.processor.loglevel to change processor logging.

Converters can be declared directly inside the configuration type. Use @JdbcConfig(converter = ...) when converter methods should live in a separate class.

import io.kaumei.jdbc.annotation.JavaToJdbc;
import io.kaumei.jdbc.annotation.config.JdbcConfig;
@JdbcConfig(converter = SharedConverters.class)
interface JdbcProcessorConfig {
}
final class SharedConverters {
private SharedConverters() {
}
@JavaToJdbc
static String customerIdToJdbc(CustomerId id) {
return id.value();
}
}

Each Maven module that runs the annotation processor should have an explicit configuration. That configuration can reference shared configuration or shared converter classes from another module.

The referenced types must be visible during annotation processing for the module that is currently compiled. Do not rely on implicit discovery across module boundaries.

For exact configuration rules, defaults, dynamic parameter overrides, and multi-module configuration boundaries, see Processor Configuration. For converter discovery and lookup, see Converter Lookup. For the complete annotation list, see Annotation Index.