Package io.micrometer.common.annotation
Class AnnotationHandler<T>
java.lang.Object
io.micrometer.common.annotation.AnnotationHandler<T>
- Type Parameters:
T- type which should be enriched withKeyValueinformation
This class is able to find all methods annotated with the Micrometer annotations. All
methods mean that if you have both an interface and an implementation annotated with
Micrometer annotations then this class is capable of finding both of them and merging
into one set of information.
This information is then used to add proper key-values to objects such as span or timer from the method arguments that are annotated with a proper annotation. Code ported from Spring Cloud Sleuth.
- Since:
- 1.11.0
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotationHandler(BiConsumer<KeyValue, T> keyValueConsumer, Function<Class<? extends ValueResolver>, ? extends ValueResolver> resolverProvider, Function<Class<? extends ValueExpressionResolver>, ? extends ValueExpressionResolver> expressionResolverProvider, Class<? extends Annotation> annotation, BiFunction<Annotation, Object, KeyValue> toKeyValue) Creates a new instance ofAnnotationHandler. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotatedParameters(T objectToModify, org.aspectj.lang.ProceedingJoinPoint pjp) Modifies the object withKeyValuerelated information.Function<Class<? extends ValueExpressionResolver>, ? extends ValueExpressionResolver> Function<Class<? extends ValueResolver>, ? extends ValueResolver>
-
Constructor Details
-
AnnotationHandler
public AnnotationHandler(BiConsumer<KeyValue, T> keyValueConsumer, Function<Class<? extends ValueResolver>, ? extends ValueResolver> resolverProvider, Function<Class<? extends ValueExpressionResolver>, ? extends ValueExpressionResolver> expressionResolverProvider, Class<? extends Annotation> annotation, BiFunction<Annotation, Object, KeyValue> toKeyValue) Creates a new instance ofAnnotationHandler.- Parameters:
keyValueConsumer- consumer that takes aKeyValueand mutates the<T>typeresolverProvider- function converting a class extending aValueResolverto an instance of that classexpressionResolverProvider- function converting a class extending aValueExpressionResolverto an instance of that classannotation- annotation containingKeyValuerelated informationtoKeyValue- function converting the annotation and the expression or annotation value to aKeyValue
-
-
Method Details
-
addAnnotatedParameters
Modifies the object withKeyValuerelated information.- Parameters:
objectToModify- object to modifypjp- proceeding join point
-
getResolverProvider
-
getExpressionResolverProvider
public Function<Class<? extends ValueExpressionResolver>,? extends ValueExpressionResolver> getExpressionResolverProvider()
-