Record Class CachedScanResult
java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.scanner.CachedScanResult
public record CachedScanResult(String classpathHash, Set<String> classNames, String timestamp)
extends Record
Cached Scan Result - Immutable record representing a cached class scan result
缓存扫描结果 - 表示缓存的类扫描结果的不可变记录
Stores the scan result along with a classpath hash for cache validation. If the classpath hash changes between runs, the cache is considered stale.
存储扫描结果及类路径哈希用于缓存验证。 如果类路径哈希在两次运行之间发生变化,则缓存视为过期。
Features | 主要功能:
- Immutable record with defensive copy - 防御性拷贝的不可变记录
- JSON serialization/deserialization - JSON 序列化/反序列化
- Classpath hash validation - 类路径哈希验证
Usage Examples | 使用示例:
CachedScanResult result = new CachedScanResult(hash, classNames, timestamp);
String json = result.toJson();
CachedScanResult restored = CachedScanResult.fromJson(json);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-classloader V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCachedScanResult(String classpathHash, Set<String> classNames, String timestamp) Compact constructor with null checks, defensive copy, and sorted storage 紧凑构造器:null 校验、防御性拷贝和排序存储 -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassNamesrecord component.Returns the value of theclasspathHashrecord component.final booleanIndicates whether some other object is "equal to" this one.static CachedScanResultDeserialize from JSON string 从 JSON 字符串反序列化final inthashCode()Returns a hash code value for this object.Returns the value of thetimestamprecord component.toJson()Serialize to JSON string 序列化为 JSON 字符串final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CachedScanResult
-
-
Method Details
-
toJson
Serialize to JSON string 序列化为 JSON 字符串- Returns:
- JSON representation | JSON 表示
-
fromJson
Deserialize from JSON string 从 JSON 字符串反序列化- Parameters:
json- JSON string | JSON 字符串- Returns:
- parsed result | 解析的结果
- Throws:
IllegalArgumentException- if JSON is invalid | JSON 无效时抛出
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
classpathHash
Returns the value of theclasspathHashrecord component.- Returns:
- the value of the
classpathHashrecord component
-
classNames
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-