Class NativeImageSupport
java.lang.Object
cloud.opencode.base.classloader.graalvm.NativeImageSupport
GraalVM Native Image detection utility
GraalVM Native Image 检测工具
Provides static methods to detect whether the application is running inside a GraalVM native image, and distinguishes build-time from run-time.
提供静态方法检测应用程序是否在 GraalVM Native Image 中运行, 并区分构建时和运行时。
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Since:
- JDK 25, opencode-base-classloader V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCheck if running at GraalVM native image build time 检测是否在 GraalVM Native Image 构建时运行static booleanCheck if running in a GraalVM native image environment 检测是否在 GraalVM Native Image 环境中运行static booleanCheck if running at GraalVM native image run time 检测是否在 GraalVM Native Image 运行时运行
-
Method Details
-
isNativeImage
public static boolean isNativeImage()Check if running in a GraalVM native image environment 检测是否在 GraalVM Native Image 环境中运行Reads the system property on each call to support dynamic testing.
每次调用时读取系统属性,以支持动态测试。
- Returns:
- true if running in native image | 如果在 Native Image 中运行返回 true
-
isBuildTime
public static boolean isBuildTime()Check if running at GraalVM native image build time 检测是否在 GraalVM Native Image 构建时运行- Returns:
- true if at build time | 如果在构建时返回 true
-
isRunTime
public static boolean isRunTime()Check if running at GraalVM native image run time 检测是否在 GraalVM Native Image 运行时运行- Returns:
- true if at run time | 如果在运行时返回 true
-