Interface Platform
- All Known Subinterfaces:
org.graalvm.nativeimage.impl.InternalPlatform.NATIVE_ONLY
,org.graalvm.nativeimage.impl.InternalPlatform.PLATFORM_JNI
,Platform.AARCH64
,Platform.AMD64
,Platform.ANDROID
,Platform.DARWIN
,Platform.DARWIN_AARCH64
,Platform.DARWIN_AMD64
,Platform.IOS
,Platform.LINUX
,Platform.LINUX_AARCH64_BASE
,Platform.LINUX_AMD64_BASE
,Platform.MACOS
,Platform.RISCV64
,Platform.WINDOWS
- All Known Implementing Classes:
Platform.ANDROID_AARCH64
,Platform.HOSTED_ONLY
,Platform.IOS_AARCH64
,Platform.IOS_AMD64
,Platform.LINUX_AARCH64
,Platform.LINUX_AMD64
,Platform.LINUX_RISCV64
,Platform.MACOS_AARCH64
,Platform.MACOS_AMD64
,Platform.WINDOWS_AARCH64
,Platform.WINDOWS_AMD64
A platform group (e.g., an architecture or OS) is an interface extending Platform
. A leaf
platform, e.g., a supported architecture-OS-combination, is a class that implements all the
groups that it belongs to. A leaf platform class must be non-abstract and must have a no-argument
constructor. It is good practice to make leaf platform classes final
(to prevent
accidental subclassing) and to avoid state (i.e., no fields).
The annotation Platforms
restricts a type, method, or field to certain platform groups or
leaf platforms.
This system makes the set of platform groups and leaf platforms extensible. Some standard platforms are defined as inner classes.
- Since:
- 19.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Supported architecture: ARMv8 64-bit.static interface
Supported architecture: x86 64-bit.static interface
Supported operating system: Android.static final class
Supported leaf platform: Android on AArch64 64-bit.static interface
Basis for all Apple operating systems (MacOS and iOS).static interface
Basis for all Apple operating systems on AMD64 (MACOS_AMD64 & IOS_AMD64).static interface
Basis for all Apple operating systems on AMD64 (MACOS_AMD64 & IOS_AMD64).static final class
Marker for elements (types, methods, or fields) that are only visible during native image generation and cannot be used at run time, regardless of the actual platform.static interface
Supported operating system: iOS.static final class
Supported leaf platform: iOS on AArch 64-bit.static final class
Supported leaf platform: iOS on x86 64-bit.static interface
Supported operating system: Linux.static final class
Supported leaf platform: Linux on AArch64 64-bit.static interface
Basis for all Linux operating systems on AARCH64 (LINUX_AARCH64 & ANDROID_AARCH64).static class
Supported leaf platform: Linux on x86 64-bit.static interface
Basis for all Linux operating systems on AMD64 (LINUX_AMD64).static final class
Supported leaf platform: Linux on RISC-V 64-bit.static interface
Supported operating system: MacOS.static final class
Supported leaf platform: MacOS on AArch 64-bit.static final class
Supported leaf platform: MacOS on x86 64-bit.static interface
Supported architecture: RISC-V 64-bit.static interface
Supported operating system: Windows.static final class
Supported leaf platform: Windows on AArch 64-bit.static final class
Supported leaf platform: Windows on x86 64-bit. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Returns the string representing Platform's architecture name.default String
getOS()
Returns the string representing Platform's OS name.static boolean
includedIn
(Class<? extends Platform> platformGroup) Returns true if the current platform (the platform that the native image is built for) is included in the provided platform group.
-
Field Details
-
PLATFORM_PROPERTY_NAME
The system property name that specifies the fully qualified name of thePlatform
implementation class that should be used. If the property is not specified, the platform class is inferred from the standard architectures and operating systems specified in this file, i.e., in most cases it is not necessary to use this property.- Since:
- 19.0
- See Also:
-
-
Method Details
-
includedIn
Returns true if the current platform (the platform that the native image is built for) is included in the provided platform group.The platformGroup must be a compile-time constant, so that the call to this method can be replaced with the constant boolean result.
- Since:
- 19.0
-
getOS
Returns the string representing Platform's OS name.This method should be implemented either in a final class or as default method in respective OS interface.
- Since:
- 21.0
-
getArchitecture
Returns the string representing Platform's architecture name. This value should be the same as desired os.arch system property.This method should be implemented either in final class or as default method in respective architecture interface.
- Since:
- 21.0
-