Class CConstant.ValueAccess
java.lang.Object
org.graalvm.nativeimage.c.constant.CConstant.ValueAccess
- Enclosing class:
CConstant
Allows access to the value of a
CConstant
during image generation.- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
Returns the value of aCConstant
, i.e., the same value that calling the annotated method would return.static <T> T
Returns the value of aCEnum
, i.e., the same value that calling the method annotated withCEnumValue
would return.
-
Method Details
-
get
Returns the value of aCConstant
, 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 withCConstant
.returnType
- The desired type of the returned value. For integer-kind constants, the supported types areBoolean
,Byte
,Short
,Character
,Integer
, andLong
. For floating point constants, the supported types areDouble
andFloat
. For string constants, the only supported types areString
andbyte[]
.- Returns:
- The value of the C constant.
- Since:
- 19.0
-
get
Returns the value of aCEnum
, i.e., the same value that calling the method annotated withCEnumValue
would return.This method is useful during native image generation, when the annotated method cannot be called.
- Parameters:
cEnum
- The enum value for which the C value should be returned. The enum type must be annotated withCEnum
.methodName
- The name of the method annotated withCEnumValue
.- Returns:
- The value of the C constant.
- Since:
- 24.2
-