Class CConstant.ValueAccess

java.lang.Object
org.graalvm.nativeimage.c.constant.CConstant.ValueAccess
Enclosing class:
CConstant

public static final class CConstant.ValueAccess extends Object
Allows access to the value of a CConstant during image generation.
Since:
19.0
  • Method Details

    • get

      public static <T> T get(Class<?> declaringClass, String methodName, Class<T> returnType)
      Returns the value of a CConstant, i.e., the same value that calling the annotated method would return.

      This method is useful during native image generation, when the annotated method cannot be called.

      Parameters:
      declaringClass - The class that contains the method.
      methodName - The name of the method annotated with CConstant.
      returnType - The desired type of the returned value. For integer-kind constants, the supported types are Long, Integer, and Boolean. For floating point constants, the only supported type is Double. For string constants, the only supported type is String.
      Returns:
      The value of the C constant.
      Since:
      19.0