Class OpenClassPath
java.lang.Object
cloud.opencode.base.classloader.OpenClassPath
OpenClassPath - ClassPath Utilities Facade
OpenClassPath - ClassPath 工具门面
Utilities for working with classpath.
用于操作 classpath 的工具。
Features | 主要功能:
- Get classpath URLs - 获取 classpath URL
- Convert class name to resource path - 类名转资源路径
- Find resources - 查找资源
Usage Examples | 使用示例:
// Get classpath URLs
List<URL> urls = OpenClassPath.getClassPathUrls();
// Convert class name to path
String path = OpenClassPath.classNameToResourcePath("com.example.MyClass");
// Returns: "com/example/MyClass.class"
// Find resource
Optional<URL> url = OpenClassPath.findResource("config.yml");
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-classloader V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanclassExists(String className) Check if class exists on classpath 检查类是否存在于 classpathstatic StringclassNameToResourcePath(String className) Convert class name to resource path 将类名转换为资源路径findResource(String resourceName) Find single resource 查找单个资源findResources(String resourceName) Find all matching resources 查找所有匹配的资源static StringGet runtime classpath string 获取运行时 classpath 字符串Get all classpath entries as paths 获取所有 classpath 条目作为路径Get all classpath URLs 获取所有 classpath URLgetPackageResources(String packageName) Get all resource URLs for a package 获取包的所有资源 URLstatic StringpackageNameToResourcePath(String packageName) Convert package name to resource path 将包名转换为资源路径static booleanresourceExists(String resourceName) Check if resource exists on classpath 检查资源是否存在于 classpathstatic StringresourcePathToClassName(String resourcePath) Convert resource path to class name 将资源路径转换为类名
-
Method Details
-
getClassPathUrls
-
getClassPathEntries
-
getClassPath
Get runtime classpath string 获取运行时 classpath 字符串- Returns:
- classpath string | classpath 字符串
-
classNameToResourcePath
-
resourcePathToClassName
-
packageNameToResourcePath
-
getPackageResources
-
findResource
-
findResources
-
resourceExists
Check if resource exists on classpath 检查资源是否存在于 classpath- Parameters:
resourceName- resource name | 资源名- Returns:
- true if exists | 存在返回 true
-
classExists
Check if class exists on classpath 检查类是否存在于 classpath- Parameters:
className- class name | 类名- Returns:
- true if exists | 存在返回 true
-