Class NativeImageUtils (2.4.0)

public class NativeImageUtils

Internal class offering helper methods for registering methods/classes for reflection.

Inheritance

java.lang.Object > NativeImageUtils

Static Methods

getMethodOrFail(Class<?> clazz, String methodName, Class<?>[] params)

public static Method getMethodOrFail(Class<?> clazz, String methodName, Class<?>[] params)

Returns the method of a class or fails if it is not present.

Parameters
NameDescription
clazzClass<?>
methodNameString
paramsClass<?>[]
Returns
TypeDescription
Method

registerClassForReflection(Feature.FeatureAccess access, String name)

public static void registerClassForReflection(Feature.FeatureAccess access, String name)

Registers an entire class for reflection use.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
nameString

registerClassHierarchyForReflection(Feature.FeatureAccess access, String className)

public static void registerClassHierarchyForReflection(Feature.FeatureAccess access, String className)

Registers the transitive class hierarchy of the provided className for reflection.

The transitive class hierarchy contains the class itself and its transitive set of non-private nested subclasses.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
classNameString

registerConstructorsForReflection(Feature.FeatureAccess access, String name)

public static void registerConstructorsForReflection(Feature.FeatureAccess access, String name)

Registers all constructors of a class for reflection.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
nameString

registerForReflectiveInstantiation(Feature.FeatureAccess access, String className)

public static void registerForReflectiveInstantiation(Feature.FeatureAccess access, String className)

Registers a class for reflective construction via its default constructor.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
classNameString

registerForUnsafeFieldAccess(Feature.FeatureAccess access, String className, String[] fields)

public static void registerForUnsafeFieldAccess(Feature.FeatureAccess access, String className, String[] fields)

Registers a class for unsafe reflective field access.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
classNameString
fieldsString[]

registerPackageForReflection(Feature.FeatureAccess access, String packageName)

public static void registerPackageForReflection(Feature.FeatureAccess access, String packageName)

Registers all the classes under the specified package for reflection.

Parameters
NameDescription
accessorg.graalvm.nativeimage.hosted.Feature.FeatureAccess
packageNameString

Constructors

NativeImageUtils()

public NativeImageUtils()