Record Class ObjectRef

java.lang.Object
java.lang.Record
org.j7m.middleware.api.ObjectRef
Record Components:
objectId - unique exported object identifier within the hosting runtime
logicalName - concrete logical object name
serviceName - logical service name used for lookup and HA alternatives
runtimeId - hosting runtime identifier
registryContext - registry context used for isolation
interfaces - exposed Java interface names
transport - transport identifier
endpoint - transport endpoint address
leaseUntil - lease expiration timestamp in milliseconds, or 0 when not leased
generation - export generation used to distinguish restarted instances
metadata - public object metadata and query parameters
All Implemented Interfaces:
Serializable

public record ObjectRef(String objectId, String logicalName, String serviceName, String runtimeId, String registryContext, List<String> interfaces, String transport, String endpoint, long leaseUntil, long generation, Map<String,String> metadata) extends Record implements Serializable
Portable reference to one concrete exported Java object instance.

An ObjectRef is not just an endpoint. It identifies an object instance, describes the logical service it belongs to, and carries enough metadata for registry lookup and HA replacement selection. The record is immutable and thread-safe.

References are routing evidence, not bearer authorization tokens. A caller still needs normal security context, authorization, fencing, and deadline checks before invocation. Metadata must be safe for status and audit output; credentials and sensitive values belong in security context, not in this record. JPMS module boundaries are unaffected by a reference: a reference to an exported object does not grant reflective access to non-exported packages. Compatibility is based on stable public fields and interface names, so future versions may add metadata keys but must preserve these record components.

See Also:
  • Constructor Details

  • Method Details

    • isLeaseActive

      public boolean isLeaseActive(long nowMillis)
      Returns whether the reference lease is active at the supplied timestamp.
      Parameters:
      nowMillis - wall-clock timestamp in milliseconds
      Returns:
      true when no lease is set or the lease is still active
    • withLeaseUntil

      public ObjectRef withLeaseUntil(long newLeaseUntil)
      Returns a copy of this reference with a new lease timestamp.
      Parameters:
      newLeaseUntil - new lease timestamp in milliseconds
      Returns:
      updated reference
    • withTransport

      public ObjectRef withTransport(String newTransport, String newEndpoint)
      Returns a copy of this reference with transport details.
      Parameters:
      newTransport - transport identifier
      newEndpoint - endpoint address
      Returns:
      updated reference
    • withMetadata

      public ObjectRef withMetadata(Map<String,String> newMetadata)
      Returns a copy of this reference with new metadata.
      Parameters:
      newMetadata - metadata to attach
      Returns:
      updated reference
    • toString

      public String toString()
      Returns a redacted diagnostic representation of this reference.

      The returned text intentionally omits endpoint text, metadata keys, and metadata values. Object references may appear in status, audit, proxy, and error diagnostics; metadata is caller controlled and must not be rendered through Map.toString() or keySet().toString().

      Specified by:
      toString in class Record
      Returns:
      redacted reference diagnostics
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • objectId

      public String objectId()
      Returns the value of the objectId record component.
      Returns:
      the value of the objectId record component
    • logicalName

      public String logicalName()
      Returns the value of the logicalName record component.
      Returns:
      the value of the logicalName record component
    • serviceName

      public String serviceName()
      Returns the value of the serviceName record component.
      Returns:
      the value of the serviceName record component
    • runtimeId

      public String runtimeId()
      Returns the value of the runtimeId record component.
      Returns:
      the value of the runtimeId record component
    • registryContext

      public String registryContext()
      Returns the value of the registryContext record component.
      Returns:
      the value of the registryContext record component
    • interfaces

      public List<String> interfaces()
      Returns the value of the interfaces record component.
      Returns:
      the value of the interfaces record component
    • transport

      public String transport()
      Returns the value of the transport record component.
      Returns:
      the value of the transport record component
    • endpoint

      public String endpoint()
      Returns the value of the endpoint record component.
      Returns:
      the value of the endpoint record component
    • leaseUntil

      public long leaseUntil()
      Returns the value of the leaseUntil record component.
      Returns:
      the value of the leaseUntil record component
    • generation

      public long generation()
      Returns the value of the generation record component.
      Returns:
      the value of the generation record component
    • metadata

      public Map<String,String> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component