java.lang.Object
io.helidon.integrations.graal.nativeimage.extension.NativeUtil

public final class NativeUtil extends Object
Utilities to help with discovery and analysis of the image.
  • Method Details

    • create

      public static NativeUtil create(NativeTrace tracer, io.github.classgraph.ScanResult scan, Function<String,Class<?>> classResolver, Function<Class<?>,Boolean> exclusion)
      Create a new instance.
      Parameters:
      tracer - tracer to log messages
      scan - classpath scan result
      classResolver - resolver of class names to classes
      exclusion - excluded classes
      Returns:
      a new utility
    • getSimpleType

      public Class<?> getSimpleType(Function<String,Class<?>> classResolver, io.github.classgraph.FieldInfo fieldInfo)
      Get the type of the field.
      Parameters:
      classResolver - resolver of names to classes
      fieldInfo - field info to get type from
      Returns:
      class of the field
    • findAnnotated

      public Set<Class<?>> findAnnotated(String annotation)
      Find all classes annotated with the provided annotation.
      Parameters:
      annotation - annotation to look for
      Returns:
      set of annotated types
    • inclusionFilter

      public Predicate<Class<?>> inclusionFilter(String description)
      Filter to exclude types that are marked as excluded.
      Parameters:
      description - filter description
      Returns:
      a new predicate
    • classMapper

      public Function<String,Class<?>> classMapper(String description)
      Class mapper.
      Parameters:
      description - description of this instance
      Returns:
      a new mapper from class names to classes
    • getSimpleType

      public Class<?> getSimpleType(Function<String,Class<?>> classResolver, io.github.classgraph.MethodParameterInfo paramInfo)
      Get the type of the parameter.
      Parameters:
      classResolver - resolver of names to classes
      paramInfo - parameter info to get type from
      Returns:
      class of the parameter
    • hasParams

      public boolean hasParams(Method method, Class<?>... params)
      Check if method has the required parameters.
      Parameters:
      method - method to check
      params - parameters to expect
      Returns:
      true if parameters of the method match the expected parameters
    • findSuperclasses

      public Set<Class<?>> findSuperclasses(Class<?> aClass)
      Find all superclasses of this type.
      Parameters:
      aClass - type
      Returns:
      all super types
    • findInterfaces

      public Set<Class<?>> findInterfaces(Class<?> aClass)
      Get all interfaces of the type.
      Parameters:
      aClass - class to get interfaces for
      Returns:
      set of interfaces with proper exclusions
    • findSubclasses

      public Set<Class<?>> findSubclasses(String superclassName)
      Find all direct subclasses of the provided type.
      Parameters:
      superclassName - type
      Returns:
      subclasses