Top Description Methods
org.graalvm.nativeimage.c.constant

public @Interface CEnum

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target, org.graalvm.nativeimage.c.CContext

Annotation to import a C enumeration to Java. In C, enumeration values are plain integer constants. In Java, enumeration values are object constants. Therefore, the Java enumeration value cannot just represent the C value, as it is done for CConstant. Instead, the Java enumeration with this annotation can define the following methods to convert between C and Java values: The Java enumeration values can be annotated with CEnumConstant to specify the C enumeration value. This annotation is optional and only needed if an attribute has a non-default value.

Note that C enumeration are merely a type-safe way to specify integer constants in C. Therefore, C enumeration values can be imported to Java as a regular CConstant; and CEnum can be used to import regular integer C constants as a Java enumeration.

The annotated class, or an outer class that contains the class, must be annotated with CContext.

Since
19.0

Method Summary

Modifier and TypeMethod and Description
public boolean
addEnumKeyword()

Add the C enum keyword to the name specified in value().

public String
value()

Specifies the name of the imported C enum type.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

addEnumKeywordback to summary
public boolean addEnumKeyword()

Add the C enum keyword to the name specified in value().

Since
19.0
valueback to summary
public String value()

Specifies the name of the imported C enum type. If no name is provided, int is used instead.

Since
19.0