Top Description Inners Fields Constructors Methods
net.bytebuddy.utility

public final Enum GraalImageCode

extends Enum<GraalImageCode>
Class Inheritance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.build.AccessControllerPlugin, net.bytebuddy.utility.nullability.MaybeNull, net.bytebuddy.utility.privilege.GetSystemPropertyAction, java.lang.reflect.Method, java.security.PrivilegedAction, java.util.Arrays, .Comparator, .List, .Locale

A utility that resolves Graal VM native image properties.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static enum
GraalImageCode.ImageCodeContextAction

A privileged action to resolve the image code via the current JVM processes input arguments, if available.

Field Summary

Modifier and TypeField and Description
public static final GraalImageCode
AGENT

Indicates that a Graal VM assisted configuration agent is running.

public static final GraalImageCode
BUILD

Indicates that a Graal VM native image build is executed.

private static GraalImageCode
current

The current image code or null if the image code was not yet resolved.

private final boolean
defined

true if this image code indicates that a valid Graal related property is set.

private final boolean
nativeImageExecution

true if this image code indicates that a Graal native image build is executed.

public static final GraalImageCode
NONE

Indicates that no Graal VM property is set.

public static final GraalImageCode
RUNTIME

Indicates that a Graal VM native image is being executed.

public static final GraalImageCode
UNKNOWN

Indicates that a Graal VM property is set to an unknown value.

Constructor Summary

AccessConstructor and Description
private
GraalImageCode(boolean
true if this image code indicates that a valid Graal related property is set.
defined
,
boolean
true if this image code indicates that a Graal native image build is executed.
nativeImageExecution
)

Creates a new Graal image code.

Method Summary

Modifier and TypeMethod and Description
private static <
The type of the action's resolved value.
T
>
T

Returns:

The action's resolved value.
doPrivileged
(PrivilegedAction<T>
The action to execute from a privileged context.
action
)

A proxy for java.security.AccessController#doPrivileged that is activated if available.

public static GraalImageCode

Returns:

The status of the Graal image code.
getCurrent
()

Resolves the status of the Graal image code.

public boolean

Returns:

true if this image code indicates that a valid Graal related property is set.
isDefined
()

Returns true if this image code indicates that a valid Graal related property is set.

public boolean

Returns:

true if this image code indicates that a Graal native image build is executed.
isNativeImageExecution
()

Returns true if this image code indicates that a Graal native image build is executed.

public <
The array component type.
T
>
T[]

Returns:

The supplied array, potentially sorted.
sorted
(T[]
The values to sort.
value
,
Comparator<? super T>
the comparator to use.
comparator
)

Sorts the provided values only if an active Graal image code is set.

public static GraalImageCode
public static GraalImageCode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AGENTback to summary
public static final GraalImageCode AGENT

Indicates that a Graal VM assisted configuration agent is running.

BUILDback to summary
public static final GraalImageCode BUILD

Indicates that a Graal VM native image build is executed.

currentback to summary
private static GraalImageCode current

The current image code or null 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.

Annotations
@MaybeNull
definedback to summary
private final boolean defined

true if this image code indicates that a valid Graal related property is set.

nativeImageExecutionback to summary
private final boolean nativeImageExecution

true if this image code indicates that a Graal native image build is executed.

NONEback to summary
public static final GraalImageCode NONE

Indicates that no Graal VM property is set.

RUNTIMEback to summary
public static final GraalImageCode RUNTIME

Indicates that a Graal VM native image is being executed.

UNKNOWNback to summary
public static final GraalImageCode UNKNOWN

Indicates that a Graal VM property is set to an unknown value.

Constructor Detail

GraalImageCodeback to summary
private GraalImageCode(boolean defined, boolean nativeImageExecution)

Creates a new Graal image code.

Parameters
defined:boolean

true if this image code indicates that a valid Graal related property is set.

nativeImageExecution:boolean

true if this image code indicates that a Graal native image build is executed.

Method Detail

doPrivilegedback to summary
private static <T> T doPrivileged(PrivilegedAction<T> action)

A proxy for java.security.AccessController#doPrivileged that is activated if available.

Parameters
<T>
The type of the action's resolved value.
action:PrivilegedAction<T>

The action to execute from a privileged context.

Returns:T

The action's resolved value.

Annotations
@MaybeNull
@Enhance
getCurrentback to summary
public static GraalImageCode getCurrent()

Resolves the status of the Graal image code.

Returns:GraalImageCode

The status of the Graal image code.

Annotations
@SuppressFBWarnings:LI_LAZY_INIT_STATIC, NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
justification:This behaviour is intended to avoid early binding in native images.
isDefinedback to summary
public boolean isDefined()

Returns true if this image code indicates that a valid Graal related property is set.

Returns:boolean

true if this image code indicates that a valid Graal related property is set.

isNativeImageExecutionback to summary
public boolean isNativeImageExecution()

Returns true if this image code indicates that a Graal native image build is executed.

Returns:boolean

true if this image code indicates that a Graal native image build is executed.

sortedback to summary
public <T> T[] sorted(T[] value, Comparator<? super T> comparator)

Sorts the provided values only if an active Graal image code is set.

Parameters
<T>
The array component type.
value:T[]

The values to sort.

comparator:Comparator<? super T>

the comparator to use.

Returns:T[]

The supplied array, potentially sorted.

valueOfback to summary
public static GraalImageCode valueOf(String name)
valuesback to summary
public static GraalImageCode[] values()
net.bytebuddy.utility back to summary

protected final Enum GraalImageCode.ImageCodeContextAction

extends Enum<GraalImageCode.ImageCodeContextAction>
implements PrivilegedAction<GraalImageCode>
Class Inheritance
All Implemented Interfaces
java.security.PrivilegedAction

A privileged action to resolve the image code via the current JVM processes input arguments, if available.

Field Summary

Modifier and TypeField and Description
public static final GraalImageCode.ImageCodeContextAction
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public GraalImageCode
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.
public static GraalImageCode.ImageCodeContextAction
public static GraalImageCode.ImageCodeContextAction[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final GraalImageCode.ImageCodeContextAction INSTANCE

The singleton instance.

Constructor Detail

ImageCodeContextActionback to summary
private ImageCodeContextAction()

Method Detail

runback to summary
public GraalImageCode run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged after enabling privileges.

Returns:GraalImageCode

a class-dependent value that may represent the results of the computation. Each class that implements PrivilegedAction should document what (if anything) this value represents.

Annotations
@Override
valueOfback to summary
public static GraalImageCode.ImageCodeContextAction valueOf(String name)
valuesback to summary
public static GraalImageCode.ImageCodeContextAction[] values()