Class HttpAnnotationProcessorUtil
java.lang.Object
eu.cloudnetservice.driver.network.http.annotation.parser.HttpAnnotationProcessorUtil
A very small utility class to more easily process annotations added to method parameters.
- Since:
- 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Annotation>
@NonNull Collection<ParameterInvocationHint>mapParameters(@NonNull Method method, @NonNull Class<A> annotationType, @NonNull BiFunction<Parameter, A, BiFunction<String, HttpContext, Object>> mapper) Applies each parameter of the given method which is annotated with the given annotation to the given mapper to determine a resolver for a value which should get injected into the parameter when receiving a http request.
-
Constructor Details
-
HttpAnnotationProcessorUtil
private HttpAnnotationProcessorUtil()
-
-
Method Details
-
mapParameters
@NonNull public static <A extends Annotation> @NonNull Collection<ParameterInvocationHint> mapParameters(@NonNull @NonNull Method method, @NonNull @NonNull Class<A> annotationType, @NonNull @NonNull BiFunction<Parameter, A, BiFunction<String, HttpContext, Object>> mapper) Applies each parameter of the given method which is annotated with the given annotation to the given mapper to determine a resolver for a value which should get injected into the parameter when receiving a http request. The mapper can return null to indicate that another processor for the same annotation should handle the request. If no resolver was determined for the parameter, each http call to the route associated with the method will result in an exception as no value for the parameter is present.- Type Parameters:
A- the full type of the annotation.- Parameters:
method- the http handler method to process.annotationType- the raw type of the annotation to handle exclusively.mapper- the mapper to determine the value resolver for each parameter of the method.- Returns:
- a collection of invocation hints which can be added to an incoming http request context.
- Throws:
NullPointerException- if the given method, annotation type or value resolver mapper is null.
-