Enum Class GraalImageCode

java.lang.Object
java.lang.Enum<GraalImageCode>
net.bytebuddy.utility.GraalImageCode
All Implemented Interfaces:
Serializable, Comparable<GraalImageCode>, Constable

public enum GraalImageCode extends Enum<GraalImageCode>
A utility that resolves Graal VM native image properties.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected 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 Constants
    Enum Constant
    Description
    Indicates 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

    Fields
    Modifier and Type
    Field
    Description
    private static GraalImageCode
    The current image code or null 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

    Constructors
    Modifier
    Constructor
    Description
    private
    GraalImageCode(boolean defined, boolean nativeImageExecution)
    Creates a new Graal image code.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static <T> T
    A proxy for java.security.AccessController#doPrivileged that is activated if available.
    Resolves the status of the Graal image code.
    boolean
    Returns true if this image code indicates that a valid Graal related property is set.
    boolean
    Returns true 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.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • 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 Details

    • current

      @MaybeNull 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.
    • defined

      private final boolean defined
      true if this image code indicates that a valid Graal related property is set.
    • nativeImageExecution

      private final boolean nativeImageExecution
      true 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

      public static GraalImageCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GraalImageCode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      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, 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(PrivilegedAction<T> action)
      A proxy for java.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()
      Returns true 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()
      Returns true 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.