- All Implemented Interfaces:
Serializable
,Comparable<ApplicationRuntime>
,Constable
The runtime where the application is running.
An application can be run in the JVM with or without the module system, depending on whether it was started with a class path or a module path. It can also be a native image generated with GraalVM.
This can be important at runtime to be able to handle different runtime behaviours, for instance resources are resolved differently whether the application is running with a class path, a module
path or a native image: we can't resolve a module resource with Module.getResourceAsStream(java.lang.String)
if the application was started with a class path and we can't list resources
with ClassLoader.resources(java.lang.String)
when running a native image.
- Since:
- 1.7
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionA native image has been started.The JVM has been started with a class path.The JVM has been started with a module path. -
Method Summary
Modifier and TypeMethodDescriptionstatic ApplicationRuntime
Returns the current runtime.static ApplicationRuntime
Returns the enum constant of this class with the specified name.static ApplicationRuntime[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
JVM_CLASSPATH
The JVM has been started with a class path. -
JVM_MODULE
The JVM has been started with a module path. -
IMAGE_NATIVE
A native image has been started.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
getApplicationRuntime
Returns the current runtime.
- Returns:
- the application runtime
-