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 ornullindicating that none was provided. The returned matched DN will be empty if none was provided (nevernull).diagnosticMessage- The diagnostic message, which may be empty ornull. The returned diagnostic message will beLocalizableMessage.EMPTYif none was provided (nevernull).referralUris- The optional referrals are present in a CompareResult if the result code is set toResultCode.REFERRAL, and they are absent with all other result codes.controls- theListcontaining the controls.cause- The throwable cause, which may benullindicating 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 Summary
ConstructorsConstructorDescriptionCompareResult(ResultCode resultCode, String matchedDn, LocalizableMessage diagnosticMessage, List<String> referralUris, List<Control> controls, Throwable cause) Creates a newCompareResult. -
Method Summary
Modifier and TypeMethodDescriptioncause()Returns the value of thecauserecord component.controls()Returns the value of thecontrolsrecord component.Returns the value of thediagnosticMessagerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatched()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.Returns the value of thematchedDnrecord component.Returns the value of thereferralUrisrecord component.Returns the value of theresultCoderecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
addControl, addControls, containsControl, getControl, getControl, removeControlsMethods inherited from interface org.forgerock.opendj.ldap.messages.Result
diagnosticMessageAsString, isReferral, isSuccess
-
Constructor Details
-
CompareResult
public CompareResult(ResultCode resultCode, String matchedDn, LocalizableMessage diagnosticMessage, List<String> referralUris, List<Control> controls, Throwable cause) Creates a newCompareResult.
-
-
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
trueif the result code is equal toResultCode.COMPARE_TRUE.- Returns:
trueif the attribute value assertion matched, otherwisefalse.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
resultCode
Returns the value of theresultCoderecord component.- Specified by:
resultCodein interfaceResult- Returns:
- the value of the
resultCoderecord component
-
matchedDn
Returns the value of thematchedDnrecord component. -
diagnosticMessage
Returns the value of thediagnosticMessagerecord component.- Specified by:
diagnosticMessagein interfaceResult- Returns:
- the value of the
diagnosticMessagerecord component
-
referralUris
Returns the value of thereferralUrisrecord component.- Specified by:
referralUrisin interfaceResult- Returns:
- the value of the
referralUrisrecord component
-
controls
Returns the value of thecontrolsrecord component.- Specified by:
controlsin interfaceProtocolOp- Returns:
- the value of the
controlsrecord component
-
cause
Returns the value of thecauserecord component.
-