Record Class CompareResult

java.lang.Object
java.lang.Record
org.forgerock.opendj.ldap.messages.CompareResult
Record Components:
resultCode - The result code.
matchedDn - The matched DN associated, which may be empty or null indicating that none was provided. The returned matched DN will be empty if none was provided (never null).
diagnosticMessage - The diagnostic message, which may be empty or null. The returned diagnostic message will be LocalizableMessage.EMPTY if none was provided (never null).
referralUris - The optional referrals are present in a CompareResult if the result code is set to ResultCode.REFERRAL, and they are absent with all other result codes.
controls - the List containing the controls.
cause - The throwable cause, which may be null indicating that none was provided.
All Implemented Interfaces:
ProtocolOp, Response, Result

public record CompareResult(ResultCode resultCode, String matchedDn, LocalizableMessage diagnosticMessage, List<String> referralUris, List<Control> controls, Throwable cause) extends Record implements Result
A Compare result indicates the final status of a Compare operation.

If the attribute value assertion in the Compare request matched a value of the attribute or subtype according to the attribute's equality matching rule then the result code is set to ResultCode.COMPARE_TRUE and can be determined by invoking the matched() method.

The following excerpt shows how to use the Compare operation to check whether a member belongs to a (possibly large) static group.

 Connection connection = ...;
 String groupDN = ...;
 String memberDN = ...;

 CompareRequest request = Requests.newCompareRequest(groupDN, "member", memberDN);
 CompareResult result = connection.compare(request);
 if (result.matched()) {
     // The member belongs to the group.
 }
 
  • Constructor Details

  • Method Details

    • matched

      public boolean matched()
      Indicates whether the attribute value assertion in the Compare request matched a value of the attribute or subtype according to the attribute's equality matching rule.

      Specifically, this method returns true if the result code is equal to ResultCode.COMPARE_TRUE.

      Returns:
      true if the attribute value assertion matched, otherwise false.
    • 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.
    • resultCode

      public ResultCode resultCode()
      Returns the value of the resultCode record component.
      Specified by:
      resultCode in interface Result
      Returns:
      the value of the resultCode record component
    • matchedDn

      public String matchedDn()
      Returns the value of the matchedDn record component.
      Specified by:
      matchedDn in interface Result
      Returns:
      the value of the matchedDn record component
    • diagnosticMessage

      public LocalizableMessage diagnosticMessage()
      Returns the value of the diagnosticMessage record component.
      Specified by:
      diagnosticMessage in interface Result
      Returns:
      the value of the diagnosticMessage record component
    • referralUris

      public List<String> referralUris()
      Returns the value of the referralUris record component.
      Specified by:
      referralUris in interface Result
      Returns:
      the value of the referralUris record component
    • controls

      public List<Control> controls()
      Returns the value of the controls record component.
      Specified by:
      controls in interface ProtocolOp
      Returns:
      the value of the controls record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Specified by:
      cause in interface Result
      Returns:
      the value of the cause record component