Class AutomaticFeatureUtils


  • public final class AutomaticFeatureUtils
    extends java.lang.Object
    Utility methods for implementing Graal's AutomaticFeature.
    Since:
    2.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addProxyClass​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String... interfaces)
      Registers the given interfaces for dynamic proxy generation.
      static void addResourceBundles​(java.lang.String... bundles)
      Adds resource bundles.
      static void addResourcePatterns​(java.lang.String... patterns)
      Adds resource patterns.
      static void initializeAtBuildTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Marks the given class to be initialized at build time, only if it is present.
      static void initializeAtBuildTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String... classNames)
      Marks the given class to be initialized at build time, only if it is present.
      static void initializeAtRunTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Marks the given class to be initialized at runtime, only if it is present.
      static void initializeAtRunTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String... classNames)
      Marks the given class to be initialized at runtime, only if it is present.
      static void initializePackagesAtBuildTime​(java.lang.String... packages)
      Initializes the packages at build time.
      static void initializePackagesAtRunTime​(java.lang.String... packages)
      Initializes the packages at run time.
      static void registerAllForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register class for runtime reflection without allowing reflective instantiation.
      static void registerAllForRuntimeReflectionAndReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register class for runtime reflection and allows reflective instantiation.
      static void registerClassForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Allows reflection instantiation of the given class, only if it is present.
      static void registerClassForRuntimeReflectionAndReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register the class and allow reflective instantiation at runtime, only if it is present.
      static void registerClassForRuntimeReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register the class for reflective instantiation at runtime, only if it is present.
      static void registerConstructorsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register all constructors of the given class for runtime reflection, only if the class is present.
      static void registerFieldsAndMethodsWithReflectiveAccess​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Register class for runtime reflection and allows reflective instantiation.
      static void registerFieldsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Allows reflection usage for all fields of the given class, only if it is present.
      static void registerMethodsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access, java.lang.String className)
      Allows reflection usage for all methods of the given class, only if it is present.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutomaticFeatureUtils

        public AutomaticFeatureUtils()
    • Method Detail

      • initializeAtBuildTime

        public static void initializeAtBuildTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                 java.lang.String className)
        Marks the given class to be initialized at build time, only if it is present.
        Parameters:
        access - the Feature.BeforeAnalysisAccess instance
        className - the class name
      • initializeAtBuildTime

        public static void initializeAtBuildTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                 java.lang.String... classNames)
        Marks the given class to be initialized at build time, only if it is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        classNames - The class names
      • initializeAtRunTime

        public static void initializeAtRunTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                               java.lang.String className)
        Marks the given class to be initialized at runtime, only if it is present.
        Parameters:
        access - the Feature.BeforeAnalysisAccess instance
        className - the class name
      • initializeAtRunTime

        public static void initializeAtRunTime​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                               java.lang.String... classNames)
        Marks the given class to be initialized at runtime, only if it is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        classNames - The class names
      • initializePackagesAtBuildTime

        public static void initializePackagesAtBuildTime​(java.lang.String... packages)
        Initializes the packages at build time.
        Parameters:
        packages - The packages
      • initializePackagesAtRunTime

        public static void initializePackagesAtRunTime​(java.lang.String... packages)
        Initializes the packages at run time.
        Parameters:
        packages - The packages
      • registerConstructorsForRuntimeReflection

        public static void registerConstructorsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                                    java.lang.String className)
        Register all constructors of the given class for runtime reflection, only if the class is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name
      • registerClassForRuntimeReflection

        public static void registerClassForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                             java.lang.String className)
        Allows reflection instantiation of the given class, only if it is present.
        Parameters:
        access - the Feature.BeforeAnalysisAccess instance
        className - the class name
      • registerClassForRuntimeReflectiveInstantiation

        public static void registerClassForRuntimeReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                                          java.lang.String className)
        Register the class for reflective instantiation at runtime, only if it is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name
      • registerClassForRuntimeReflectionAndReflectiveInstantiation

        public static void registerClassForRuntimeReflectionAndReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                                                       java.lang.String className)
        Register the class and allow reflective instantiation at runtime, only if it is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name
      • registerMethodsForRuntimeReflection

        public static void registerMethodsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                               java.lang.String className)
        Allows reflection usage for all methods of the given class, only if it is present.
        Parameters:
        access - the Feature.BeforeAnalysisAccess instance
        className - the class name
      • registerFieldsForRuntimeReflection

        public static void registerFieldsForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                              java.lang.String className)
        Allows reflection usage for all fields of the given class, only if it is present.
        Parameters:
        access - the Feature.BeforeAnalysisAccess instance
        className - the class name
      • addProxyClass

        public static void addProxyClass​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                         java.lang.String... interfaces)
        Registers the given interfaces for dynamic proxy generation.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        interfaces - the list of interfaces that the generated proxy can implement
      • addResourcePatterns

        public static void addResourcePatterns​(java.lang.String... patterns)
        Adds resource patterns.
        Parameters:
        patterns - The patterns
      • addResourceBundles

        public static void addResourceBundles​(java.lang.String... bundles)
        Adds resource bundles.
        Parameters:
        bundles - The bundles
      • registerAllForRuntimeReflectionAndReflectiveInstantiation

        public static void registerAllForRuntimeReflectionAndReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                                                     java.lang.String className)
        Register class for runtime reflection and allows reflective instantiation. Also register all fields, methods and constructors for runtime reflection; only if the class is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name
      • registerAllForRuntimeReflection

        public static void registerAllForRuntimeReflection​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                           java.lang.String className)
        Register class for runtime reflection without allowing reflective instantiation. Also register all fields, methods and constructors for runtime reflection; only if the class is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name
      • registerFieldsAndMethodsWithReflectiveAccess

        public static void registerFieldsAndMethodsWithReflectiveAccess​(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess access,
                                                                        java.lang.String className)
        Register class for runtime reflection and allows reflective instantiation. Also register all fields and methods for runtime reflection; only if the class is present.
        Parameters:
        access - The Feature.BeforeAnalysisAccess instance
        className - The class name