Class WebParameterProcessor
- All Implemented Interfaces:
Processor
@QueryParam
, @PathParam
, @HeaderParam
, @CookieParam
, or @FormParam
.
This processor is necessary for Java-based Flux Capacitor applications where method parameter names are not retained at runtime (due to type erasure and lack of debug metadata). Without this step, the framework cannot reliably bind path, query, or form parameters to method arguments in web handler methods.
How It Works
During compilation, the processor scans for any methods containing web parameter annotations. For each enclosing
class, it generates a companion _params
class (e.g. MyHandler_params
) that extends
ParameterRegistry
. This generated class maps method signatures to ordered parameter name lists.
At runtime, the framework consults these generated registries to resolve argument names for annotated web handler methods—effectively restoring the parameter names that would otherwise be erased.
Kotlin applications do not require this processor, as parameter names are preserved by default in compiled code.
Example
For a Java method like:
@HandleWeb
public String getUser(@PathParam("id") String userId, @QueryParam boolean verbose) {
...
}
the processor will generate:
result.put("getUser(java.lang.String,boolean)", List.of("userId", "verbose"));
Usage
- Automatically registered via
@AutoService(Processor.class)
- Triggered by any of the supported parameter annotations
- Works in combination with
ParameterRegistry
- See Also:
-
Field Summary
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
init
(ProcessingEnvironment processingEnv) boolean
process
(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, isInitialized
-
Constructor Details
-
WebParameterProcessor
public WebParameterProcessor()
-
-
Method Details
-
init
- Specified by:
init
in interfaceProcessor
- Overrides:
init
in classAbstractProcessor
-
process
- Specified by:
process
in interfaceProcessor
- Specified by:
process
in classAbstractProcessor
-
getSupportedSourceVersion
- Specified by:
getSupportedSourceVersion
in interfaceProcessor
- Overrides:
getSupportedSourceVersion
in classAbstractProcessor
-