Class ParameterRegistry
java.lang.Object
io.fluxzero.common.reflection.ParameterRegistry
Registry for accessing method parameter names at runtime in environments where Java reflection does not retain them
(e.g. Java applications compiled without debug information).
This class works in tandem with annotation processors, which generate a companion _params class per handler
class at compile time (see e.g.: WebParameterProcessor). The generated class extends this
ParameterRegistry and provides a static map from method signatures to parameter name lists.
At runtime, the framework uses this registry to retrieve parameter names for handler methods
annotated with web-related annotations such as @QueryParam, @PathParam, etc. This is especially
important for Java applications, where parameter names are not always available through standard reflection.
For example, given a method:
public void getUser(@PathParam("id") String userId) { ... }
the generated registry allows the framework to resolve "userId" even if it's not available via reflection.
Key Features
- Loads generated registries dynamically using class naming conventions
- Provides lookup by
ExecutableorParameter - Memoizes results for performance
- Uses method signature format:
methodName(paramType1,paramType2)
Internal Use Only
This utility is not intended for application developers to use directly. It is used internally by Fluxzero's web framework components.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetParameterName(Parameter parameter) Retrieves the name of a specific method parameter.getParameterNames(Executable method) Retrieves the parameter names for a given method.static ParameterRegistryReturns the registry instance for the specified class, loading and memoizing the generated_paramsclass on first access.static Stringsignature(Executable method) Generates a string representation of a method signature using a runtime reflectionExecutable.static Stringsignature(ExecutableElement method) Generates a string representation of a method signature using compile-time elements.
-
Constructor Details
-
ParameterRegistry
public ParameterRegistry()
-
-
Method Details
-
getParameterNames
Retrieves the parameter names for a given method.- Parameters:
method- the reflectiveExecutable(method or constructor)- Returns:
- the list of parameter names, in declaration order
- Throws:
IllegalStateException- if no parameter names are found
-
getParameterName
-
of
Returns the registry instance for the specified class, loading and memoizing the generated_paramsclass on first access.- Parameters:
type- the source class for which to obtain a registry- Returns:
- the corresponding
ParameterRegistryinstance
-
signature
Generates a string representation of a method signature using compile-time elements.- Parameters:
method- the method element- Returns:
- a signature string in the format
methodName(paramType1,paramType2)
-
signature
Generates a string representation of a method signature using a runtime reflectionExecutable.- Parameters:
method- the method or constructor- Returns:
- a signature string in the format
methodName(paramType1,paramType2)
-