Package net.bytebuddy.utility
Enum GraalImageCode
- All Implemented Interfaces:
Serializable
,Comparable<GraalImageCode>
,java.lang.constant.Constable
A utility that resolves Graal VM native image properties.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
A privileged action to resolve the image code via the current JVM processes input arguments, if available.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIndicates that a Graal VM assisted configuration agent is running.Indicates that a Graal VM native image build is executed.Indicates that no Graal VM property is set.Indicates that a Graal VM native image is being executed.Indicates that a Graal VM property is set to an unknown value. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static GraalImageCode
The current image code ornull
if the image code was not yet resolved.private final boolean
true
if this image code indicates that a valid Graal related property is set.private final boolean
true
if this image code indicates that a Graal native image build is executed. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GraalImageCode
(boolean defined, boolean nativeImageExecution) Creates a new Graal image code. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> T
doPrivileged
(PrivilegedAction<T> action) A proxy forjava.security.AccessController#doPrivileged
that is activated if available.static GraalImageCode
Resolves the status of the Graal image code.boolean
Returnstrue
if this image code indicates that a valid Graal related property is set.boolean
Returnstrue
if this image code indicates that a Graal native image build is executed.<T> T[]
sorted
(T[] value, Comparator<? super T> comparator) Sorts the provided values only if an active Graal image code is set.static GraalImageCode
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 Details
-
AGENT
Indicates that a Graal VM assisted configuration agent is running. -
BUILD
Indicates that a Graal VM native image build is executed. -
RUNTIME
Indicates that a Graal VM native image is being executed. -
UNKNOWN
Indicates that a Graal VM property is set to an unknown value. -
NONE
Indicates that no Graal VM property is set.
-
-
Field Details
-
current
The current image code ornull
if 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 definedtrue
if this image code indicates that a valid Graal related property is set. -
nativeImageExecution
private final boolean nativeImageExecutiontrue
if this image code indicates that a Graal native image build is executed.
-
-
Constructor Details
-
GraalImageCode
private GraalImageCode(boolean defined, boolean nativeImageExecution) Creates a new Graal image code.- Parameters:
defined
-true
if this image code indicates that a valid Graal related property is set.nativeImageExecution
-true
if this image code indicates that a Graal native image build is executed.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getCurrent
Resolves the status of the Graal image code.- Returns:
- The status of the Graal image code.
-
sorted
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
A proxy forjava.security.AccessController#doPrivileged
that 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()Returnstrue
if this image code indicates that a valid Graal related property is set.- Returns:
true
if this image code indicates that a valid Graal related property is set.
-
isNativeImageExecution
public boolean isNativeImageExecution()Returnstrue
if this image code indicates that a Graal native image build is executed.- Returns:
true
if this image code indicates that a Graal native image build is executed.
-