Record Class CompareRequest
java.lang.Object
java.lang.Record
org.forgerock.opendj.ldap.messages.CompareRequest
- Record Components:
name- the distinguished name of the entry to be compared. The server shall not dereference any aliases in locating the entry to be compared.attributeDescription- the name of the attribute to be compared.assertionValue- the assertion value to be compared.controls- theListcontaining the controls.
- All Implemented Interfaces:
ProtocolOp, Request
public record CompareRequest(Dn name, AttributeDescription attributeDescription, ByteString assertionValue, List<Control> controls)
extends Record
implements Request
The Compare operation allows a client to compare an assertion value with the
values of a particular attribute in a particular entry in the Directory.
Note that some directory systems may establish access controls that permit
the values of certain attributes (such as userPassword ) to be
compared but not interrogated by other means.
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.
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface Request
Request.RequestType -
Constructor Summary
ConstructorsConstructorDescriptionCompareRequest(Dn name, AttributeDescription attributeDescription, ByteString assertionValue, List<Control> controls) Create a newCompareRequest. -
Method Summary
Modifier and TypeMethodDescription<R, P, E extends Exception>
Raccept(RequestVisitor<R, P, E> v, P p) Applies aRequestVisitorto thisRequest.Returns the value of theassertionValuerecord component.Returns the value of theattributeDescriptionrecord component.controls()Returns the value of thecontrolsrecord component.final booleanIndicates whether some other object is "equal to" this one.getType()Returns the type of this request to avoid expensiveinstanceofchecks.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface ProtocolOp
addControl, addControls, containsControl, getControl, getControl, removeControls
-
Constructor Details
-
CompareRequest
public CompareRequest(Dn name, AttributeDescription attributeDescription, ByteString assertionValue, List<Control> controls) Create a newCompareRequest.
-
-
Method Details
-
accept
Description copied from interface:RequestApplies aRequestVisitorto thisRequest.- Specified by:
acceptin interfaceRequest- Type Parameters:
R- The return type of the visitor's methods.P- The type of the additional parameters to the visitor's methods.E- The type of the exception thrown by the visitor method if it fails, orNeverThrowsExceptionif the visitor cannot fail.- Parameters:
v- The request visitor.p- Optional additional visitor parameter.- Returns:
- A result as specified by the visitor.
- Throws:
E- If the visitor failed.
-
getType
Description copied from interface:RequestReturns the type of this request to avoid expensiveinstanceofchecks. -
toString
-
hashCode
-
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). -
name
-
attributeDescription
Returns the value of theattributeDescriptionrecord component.- Returns:
- the value of the
attributeDescriptionrecord component
-
assertionValue
Returns the value of theassertionValuerecord component.- Returns:
- the value of the
assertionValuerecord component
-
controls
-