Record Class AuditEnvelope

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.audit.AuditEnvelope
Record Components:
id - non-blank store-assigned identifier
tenant - tenant scope of the event; null becomes TenantId.DEFAULT
event - the wrapped audit event; never null

@ExperimentalJSentinelApi public record AuditEnvelope(String id, TenantId tenant, AuditEvent event) extends Record
Persisted form of an AuditEvent. Pairs the event with a store-assigned identifier and the tenant scope so a queryable audit store can return events that survived past one in-process buffer.

The id is opaque to the framework: implementations of AuditEventStore are free to use UUIDs, monotonic counters, or any other stable identifier — the only contract is that id uniquely identifies the envelope within the store.

  • Constructor Details

    • AuditEnvelope

      public AuditEnvelope(String id, TenantId tenant, AuditEvent event)
      Validates the record components and substitutes TenantId.DEFAULT for a null tenant.
      Parameters:
      id - non-blank store-assigned identifier
      tenant - tenant scope; null becomes TenantId.DEFAULT
      event - non-null audit event
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • tenant

      public TenantId tenant()
      Returns the value of the tenant record component.
      Returns:
      the value of the tenant record component
    • event

      public AuditEvent event()
      Returns the value of the event record component.
      Returns:
      the value of the event record component