Class AuditEvent.Builder

java.lang.Object
cloud.opencode.base.log.audit.AuditEvent.Builder
Enclosing class:
AuditEvent

public static final class AuditEvent.Builder extends Object
Builder for AuditEvent. AuditEvent 的构建器。
Since:
JDK 25, opencode-base-log V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • eventId

      public AuditEvent.Builder eventId(String eventId)
      Sets the event ID. 设置事件 ID。
      Parameters:
      eventId - the event ID - 事件 ID
      Returns:
      this builder - 此构建器
    • timestamp

      public AuditEvent.Builder timestamp(Instant timestamp)
      Sets the timestamp. 设置时间戳。
      Parameters:
      timestamp - the timestamp - 时间戳
      Returns:
      this builder - 此构建器
    • userId

      public AuditEvent.Builder userId(String userId)
      Sets the user ID. 设置用户 ID。
      Parameters:
      userId - the user ID - 用户 ID
      Returns:
      this builder - 此构建器
    • target

      public AuditEvent.Builder target(String target)
      Sets the target. 设置目标。
      Parameters:
      target - the target - 目标
      Returns:
      this builder - 此构建器
    • targetId

      public AuditEvent.Builder targetId(String targetId)
      Sets the target ID. 设置目标 ID。
      Parameters:
      targetId - the target ID - 目标 ID
      Returns:
      this builder - 此构建器
    • result

      public AuditEvent.Builder result(String result)
      Sets the result. 设置结果。
      Parameters:
      result - the result - 结果
      Returns:
      this builder - 此构建器
    • success

      public AuditEvent.Builder success()
      Sets the result as success. 设置结果为成功。
      Returns:
      this builder - 此构建器
    • failure

      public AuditEvent.Builder failure()
      Sets the result as failure. 设置结果为失败。
      Returns:
      this builder - 此构建器
    • ip

      public AuditEvent.Builder ip(String ip)
      Sets the IP address. 设置 IP 地址。
      Parameters:
      ip - the IP address - IP 地址
      Returns:
      this builder - 此构建器
    • userAgent

      public AuditEvent.Builder userAgent(String userAgent)
      Sets the user agent. 设置用户代理。
      Parameters:
      userAgent - the user agent - 用户代理
      Returns:
      this builder - 此构建器
    • detail

      public AuditEvent.Builder detail(String key, Object value)
      Adds a detail. 添加详情。
      Parameters:
      key - the detail key - 详情键
      value - the detail value - 详情值
      Returns:
      this builder - 此构建器
    • details

      public AuditEvent.Builder details(Map<String,Object> details)
      Adds multiple details. 添加多个详情。
      Parameters:
      details - the details - 详情
      Returns:
      this builder - 此构建器
    • build

      public AuditEvent build()
      Builds the audit event. 构建审计事件。
      Returns:
      the audit event - 审计事件