Class NativeImageMetadata

java.lang.Object
org.atmosphere.nativeimage.NativeImageMetadata

public final class NativeImageMetadata extends Object
The merged view of every NativeImageMetadataProvider on the classpath.

One place asks the question, so every consumer gets the same answer: the Spring Boot hints registrar, the Quarkus build step, and the generator that embeds GraalVM metadata into the shipped jars. Before this existed the same hand-written list was copied into three integration modules and no extension module could contribute at all — a shape where the Quarkus and Spring answers could drift apart, and where a plain servlet deployment got nothing.

Discovery is a union: providers cannot remove each other's entries, only add. Registering a type that is never used costs image size; failing to register one that is used costs a runtime failure, usually a silent one. The asymmetry is the reason this errs toward inclusion.

  • Method Details

    • collect

      public static NativeImageMetadata collect()
      Collect using the class loader that loaded this class.
    • collect

      public static NativeImageMetadata collect(ClassLoader classLoader)
      Collect from every available provider visible to classLoader.

      A provider that throws while loading is skipped with a warning rather than aborting: it is one module's metadata, and losing it should not stop an image build or a startup that would otherwise succeed. The skip is logged at WARN because the consequence — some types quietly unregistered — is exactly the kind of thing that must not pass unnoticed.

      Parameters:
      classLoader - loader to search, may be null for the system loader
      Returns:
      the merged metadata, never null
    • reflectiveTypes

      public List<String> reflectiveTypes()
      Type names to register for reflection, de-duplicated, in provider order.
    • resourcePatterns

      public List<String> resourcePatterns()
      Resource patterns to include in the image, de-duplicated, in provider order.
    • providerNames

      public List<String> providerNames()
      Names of the providers that contributed, for logging and generated-file provenance.
    • typeReachedCondition

      public String typeReachedCondition(String type)
      The typeReached condition for a reflective type, when its provider declared one (see NativeImageMetadataProvider.typeReachedCondition()).
      Parameters:
      type - a name from reflectiveTypes()
      Returns:
      the gating type name, or null when unconditional