Record Class ResourceEvent
java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.resource.ResourceEvent
public record ResourceEvent(ResourceEvent.Type type, Resource resource, long timestamp)
extends Record
Resource Change Event - Represents a file system change event for a resource
资源变更事件 - 表示资源的文件系统变更事件
Immutable record capturing the type of change, the affected resource, and the timestamp.
不可变记录,包含变更类型、受影响的资源和时间戳。
Usage Examples | 使用示例:
ResourceEvent event = new ResourceEvent(
ResourceEvent.Type.MODIFIED,
new FileResource("/etc/config.yml"),
System.currentTimeMillis()
);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-classloader V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumResource change event type 资源变更事件类型 -
Constructor Summary
ConstructorsConstructorDescriptionResourceEvent(ResourceEvent.Type type, Resource resource, long timestamp) Compact constructor with null validation 紧凑构造器,包含空值校验 -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.resource()Returns the value of theresourcerecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
ResourceEvent
Compact constructor with null validation 紧凑构造器,包含空值校验- Throws:
NullPointerException- if type or resource is null | 如果 type 或 resource 为 null 则抛出
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
resource
Returns the value of theresourcerecord component.- Returns:
- the value of the
resourcerecord component
-
timestamp
public long timestamp()Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-