Record Class LdapMessage

java.lang.Object
java.lang.Record
org.forgerock.opendj.ldap.messages.LdapMessage
Record Components:
messageId - The LDAP message ID.
protocolOpType - The LDAP message type.
protocolOp - The LDAP message content.

public record LdapMessage(int messageId, byte protocolOpType, ProtocolOp protocolOp) extends Record
Encapsulates a ProtocolOp with LDAP specific message information.
  • Constructor Details

    • LdapMessage

      public LdapMessage(int messageId, byte protocolOpType, ProtocolOp protocolOp)
      Creates an instance of a LdapMessage record class.
      Parameters:
      messageId - the value for the messageId record component
      protocolOpType - the value for the protocolOpType record component
      protocolOp - the value for the protocolOp record component
  • Method Details

    • newRequestMessage

      public static LdapMessage newRequestMessage(int messageId, Request request)
      Builds and returns an LdapMessage containing a Request.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType from the actual type of request.
      Parameters:
      messageId - Identifier of this message
      request - The fully decoded Request
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, Request forRequest, Response response)
      Builds and returns an LdapMessage containing a Response.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType from the actual type of request this response respond to.
      Parameters:
      messageId - Identifier of this message
      forRequest - The Request the response is responding to.
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, SearchResultEntry response)
      Builds and returns an LdapMessage containing a SearchResultEntry.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, SearchResultReference response)
      Builds and returns an LdapMessage containing a SearchResultReference.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, IntermediateResponse response)
      Builds and returns an LdapMessage containing a IntermediateResponse.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, BindResult response)
      Builds and returns an LdapMessage containing a BindResult.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, ExtendedResult response)
      Builds and returns an LdapMessage containing a ExtendedResult.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newResponseMessage

      public static LdapMessage newResponseMessage(int messageId, CompareResult response)
      Builds and returns an LdapMessage containing a CompareResult.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by inferring the protocolOpType.
      Parameters:
      messageId - Identifier of this message
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • newSearchResultDoneMessage

      public static LdapMessage newSearchResultDoneMessage(int messageId, Result result)
      Builds and returns an LdapMessage for a search result done operation type.
      This method simplifies LdapMessage(int, byte, ProtocolOp) by removing the protocolOpType parameter when it can be inferred from the actual type of protocolOp.
      Parameters:
      messageId - Unique identifier of this message
      result - The search result done result
      Returns:
      a new LdapMessage
    • newResponseMessage

      public LdapMessage newResponseMessage(Response response)
      Returns a new LdapMessage containing the provided Response.
      Parameters:
      response - The response which will be contained in the returned message
      Returns:
      a new LdapMessage
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • messageId

      public int messageId()
      Returns the value of the messageId record component.
      Returns:
      the value of the messageId record component
    • protocolOpType

      public byte protocolOpType()
      Returns the value of the protocolOpType record component.
      Returns:
      the value of the protocolOpType record component
    • protocolOp

      public ProtocolOp protocolOp()
      Returns the value of the protocolOp record component.
      Returns:
      the value of the protocolOp record component