Package net.bytebuddy.utility
Enum GraalImageCode
- java.lang.Object
-
- java.lang.Enum<GraalImageCode>
-
- net.bytebuddy.utility.GraalImageCode
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<GraalImageCode>
public enum GraalImageCode extends java.lang.Enum<GraalImageCode>
A utility that resolves Graal VM native image properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classGraalImageCode.ImageCodeContextActionA privileged action to resolve the image code via the current JVM processes input arguments, if available.
-
Enum Constant Summary
Enum Constants Enum Constant Description AGENTIndicates that a Graal VM assisted configuration agent is running.BUILDIndicates that a Graal VM native image build is executed.NONEIndicates that no Graal VM property is set.RUNTIMEIndicates that a Graal VM native image is being executed.UNKNOWNIndicates that a Graal VM property is set to an unknown value.
-
Field Summary
Fields Modifier and Type Field Description private static GraalImageCodecurrentThe current image code ornullif the image code was not yet resolved.private booleandefinedtrueif this image code indicates that a valid Graal related property is set.private booleannativeImageExecutiontrueif this image code indicates that a Graal native image build is executed.static java.lang.StringREPRODUCIBLE_PROPERTIESIndicates that member properties and annotations should be sorted when being read.private static booleanSORTEDResolves if properties should always be sorted at the cost of some runtime overhead.
-
Constructor Summary
Constructors Modifier Constructor Description privateGraalImageCode(boolean defined, boolean nativeImageExecution)Creates a new Graal image code.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <T> TdoPrivileged(java.security.PrivilegedAction<T> action)A proxy forjava.security.AccessController#doPrivilegedthat is activated if available.static GraalImageCodegetCurrent()Resolves the status of the Graal image code.booleanisDefined()Returnstrueif this image code indicates that a valid Graal related property is set.booleanisNativeImageExecution()Returnstrueif this image code indicates that a Graal native image build is executed.<T> T[]sorted(T[] value, java.util.Comparator<? super T> comparator)Sorts the provided values only if an active Graal image code is set.static GraalImageCodevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static GraalImageCode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AGENT
public static final GraalImageCode AGENT
Indicates that a Graal VM assisted configuration agent is running.
-
BUILD
public static final GraalImageCode BUILD
Indicates that a Graal VM native image build is executed.
-
RUNTIME
public static final GraalImageCode RUNTIME
Indicates that a Graal VM native image is being executed.
-
UNKNOWN
public static final GraalImageCode UNKNOWN
Indicates that a Graal VM property is set to an unknown value.
-
NONE
public static final GraalImageCode NONE
Indicates that no Graal VM property is set.
-
-
Field Detail
-
REPRODUCIBLE_PROPERTIES
public static final java.lang.String REPRODUCIBLE_PROPERTIES
Indicates that member properties and annotations should be sorted when being read.- See Also:
- Constant Field Values
-
SORTED
private static final boolean SORTED
Resolves if properties should always be sorted at the cost of some runtime overhead.
-
current
@MaybeNull private static GraalImageCode current
The current image code ornullif the image code was not yet resolved. The image code must be initialized lazily to avoid that it's bound to a value during native compilation.
-
defined
private final boolean defined
trueif this image code indicates that a valid Graal related property is set.
-
nativeImageExecution
private final boolean nativeImageExecution
trueif this image code indicates that a Graal native image build is executed.
-
-
Constructor Detail
-
GraalImageCode
private GraalImageCode(boolean defined, boolean nativeImageExecution)Creates a new Graal image code.- Parameters:
defined-trueif this image code indicates that a valid Graal related property is set.nativeImageExecution-trueif this image code indicates that a Graal native image build is executed.
-
-
Method Detail
-
values
public static GraalImageCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GraalImageCode c : GraalImageCode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static GraalImageCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getCurrent
public static GraalImageCode getCurrent()
Resolves the status of the Graal image code.- Returns:
- The status of the Graal image code.
-
sorted
public <T> T[] sorted(T[] value, java.util.Comparator<? super T> comparator)Sorts the provided values only if an active Graal image code is set.- Type Parameters:
T- The array component type.- Parameters:
value- The values to sort.comparator- the comparator to use.- Returns:
- The supplied array, potentially sorted.
-
doPrivileged
@MaybeNull @Enhance private static <T> T doPrivileged(java.security.PrivilegedAction<T> action)
A proxy forjava.security.AccessController#doPrivilegedthat is activated if available.- Type Parameters:
T- The type of the action's resolved value.- Parameters:
action- The action to execute from a privileged context.- Returns:
- The action's resolved value.
-
isDefined
public boolean isDefined()
Returnstrueif this image code indicates that a valid Graal related property is set.- Returns:
trueif this image code indicates that a valid Graal related property is set.
-
isNativeImageExecution
public boolean isNativeImageExecution()
Returnstrueif this image code indicates that a Graal native image build is executed.- Returns:
trueif this image code indicates that a Graal native image build is executed.
-
-