Class ReflectionHelper

java.lang.Object
org.apache.camel.spring.boot.aot.ReflectionHelper

public final class ReflectionHelper extends Object
ReflectionHelper utility class providing methods needed for the native mode.
  • 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 either ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, or ElementType.PARAMETER.
      Type Parameters:
      A - the type of the target annotation
      T - the type of the content extracted from the annotation found
      Parameters:
      c - the target class
      a - the target type of annotation
      getter - the method allowing to extract the excepted values from the annotation
      onMatch - 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 loaded
      annotations - 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 loaded
      includeFilters - the filters to apply the classes found
      Returns:
      a list of classes that match with at least one of the given filters