Class PoolNativeImageMetadataProvider

java.lang.Object
org.atmosphere.nativeimage.PoolNativeImageMetadataProvider
All Implemented Interfaces:
NativeImageMetadataProvider

public class PoolNativeImageMetadataProvider extends Object implements NativeImageMetadataProvider
Pooled-object types, contributed only when commons-pool2 is present.

The demonstration of why NativeImageMetadataProvider.isAvailable() exists: these types extend commons-pool2 interfaces, so naming them in an image built without that dependency asks GraalVM to resolve a supertype that is not there. Gating on the dependency keeps the metadata honest about what this particular application actually contains.

  • Constructor Details

    • PoolNativeImageMetadataProvider

      public PoolNativeImageMetadataProvider()
  • Method Details

    • name

      public String name()
      Description copied from interface: NativeImageMetadataProvider
      Identifier for logs and the generated metadata's provenance comment.
      Specified by:
      name in interface NativeImageMetadataProvider
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: NativeImageMetadataProvider
      Whether this provider applies to the current classpath. A provider covering an optional dependency returns false when that dependency is absent, so its types are not registered into an image that cannot contain them.
      Specified by:
      isAvailable in interface NativeImageMetadataProvider
      Returns:
      true to include this provider's metadata
    • typeReachedCondition

      public String typeReachedCondition()
      isAvailable() alone is not enough for the metadata shipped in the atmosphere-runtime jar: it is generated where commons-pool2 is on the classpath, so the condition keeps an application image without commons-pool2 from initializing these types against a missing supertype.
      Specified by:
      typeReachedCondition in interface NativeImageMetadataProvider
      Returns:
      a fully-qualified type name, or null for unconditional
    • reflectiveTypes

      public Collection<String> reflectiveTypes()
      Description copied from interface: NativeImageMetadataProvider
      Fully-qualified names of types that are constructed, inspected or invoked reflectively — typically anything selected by an init-param or read from a ServiceLoader file.

      Names rather than Class literals: a provider must be able to declare a type from an optional dependency without forcing that dependency to be present, which is the same reason the framework's own AtmosphereReflectiveTypes is a list of strings.

      Specified by:
      reflectiveTypes in interface NativeImageMetadataProvider
      Returns:
      type names, never null