Package org.apache.camel.spring.boot.aot
Class ReflectionHelper
java.lang.Object
org.apache.camel.spring.boot.aot.ReflectionHelper
ReflectionHelper utility class providing methods needed for the native mode.-
Method Summary
Modifier and TypeMethodDescriptionstatic <A extends Annotation,T>
voidapplyIfMatch(Class<?> c, Class<A> a, Function<A, T> getter, Consumer<T> onMatch) Apply a specific action anytime the annotation is found in the class according to the type of target supported by the annotation which can be eitherElementType.TYPE,ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.FIELD, orElementType.PARAMETER.getClassesByAnnotations(ClassLoader classLoader, List<Class<? extends Annotation>> annotations) Give all the classes available in the given class loader that are annotated with at least one of the annotations.getClassesByFilters(ClassLoader classLoader, List<org.springframework.core.type.filter.TypeFilter> includeFilters) Give all the classes available in the given class loader that match with at least one of the filters.
-
Method Details
-
applyIfMatch
public static <A extends Annotation,T> void applyIfMatch(Class<?> c, Class<A> a, Function<A, T> getter, Consumer<T> onMatch) Apply a specific action anytime the annotation is found in the class according to the type of target supported by the annotation which can be eitherElementType.TYPE,ElementType.CONSTRUCTOR,ElementType.METHOD,ElementType.FIELD, orElementType.PARAMETER.- Type Parameters:
A- the type of the target annotationT- the type of the content extracted from the annotation found- Parameters:
c- the target classa- the target type of annotationgetter- the method allowing to extract the excepted values from the annotationonMatch- the action to perform in case of a match
-
getClassesByAnnotations
public static List<Class<?>> getClassesByAnnotations(ClassLoader classLoader, List<Class<? extends Annotation>> annotations) Give all the classes available in the given class loader that are annotated with at least one of the annotations.- Parameters:
classLoader- the class loader from which the classes to find are loadedannotations- the target annotations- Returns:
- the list of classes that are annotated with at least one of the annotations.
-
getClassesByFilters
public static List<Class<?>> getClassesByFilters(ClassLoader classLoader, List<org.springframework.core.type.filter.TypeFilter> includeFilters) Give all the classes available in the given class loader that match with at least one of the filters.- Parameters:
classLoader- the class loader from which the classes to find are loadedincludeFilters- the filters to apply the classes found- Returns:
- a list of classes that match with at least one of the given filters
-