com.unboundid.ldap.sdk
Class LDAPResult

java.lang.Object
  extended by com.unboundid.ldap.sdk.LDAPResult
All Implemented Interfaces:
LDAPResponse, java.io.Serializable
Direct Known Subclasses:
BindResult, CompareResult, ExtendedResult, SearchResult

public class LDAPResult
extends java.lang.Object
implements java.io.Serializable, LDAPResponse

This class provides a data structure for holding the elements that are common to most types of LDAP responses. The elements contained in an LDAP result include:



Note that even though this class is marked with the @Extensible annotation type, it should not be directly subclassed by third-party code. Only the BindResult and ExtendedResult subclasses are actually intended to be extended by third-party code.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.unboundid.ldap.protocol.LDAPResponse
NO_CONTROLS
 
Constructor Summary
  LDAPResult(int messageID, ResultCode resultCode)
          Creates a new LDAP result object with the provided message ID and result code, and no other information.
  LDAPResult(int messageID, ResultCode resultCode, java.lang.String diagnosticMessage, java.lang.String matchedDN, java.util.List<java.lang.String> referralURLs, java.util.List<Control> responseControls)
          Creates a new LDAP result object with the provided information.
  LDAPResult(int messageID, ResultCode resultCode, java.lang.String diagnosticMessage, java.lang.String matchedDN, java.lang.String[] referralURLs, Control[] responseControls)
          Creates a new LDAP result object with the provided information.
protected LDAPResult(LDAPResult result)
          Creates a new LDAP result object based on the provided result.
 
Method Summary
 java.lang.String getDiagnosticMessage()
          Retrieves the diagnostic message from the response, if available.
 java.lang.String getMatchedDN()
          Retrieves the matched DN from the response, if available.
 int getMessageID()
          Retrieves the message ID for the LDAP message with which this LDAP result is associated.
 java.lang.String[] getReferralURLs()
          Retrieves the set of referral URLs from the response, if available.
 Control getResponseControl(java.lang.String oid)
          Retrieves the response control with the specified OID.
 Control[] getResponseControls()
          Retrieves the set of controls from the response, if available.
 ResultCode getResultCode()
          Retrieves the result code from the response.
 boolean hasResponseControl()
          Indicates whether this result contains at least one control.
 boolean hasResponseControl(java.lang.String oid)
          Indicates whether this result contains at least one control with the specified OID.
 java.lang.String toString()
          Retrieves a string representation of this LDAP result.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this LDAP result to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPResult

protected LDAPResult(LDAPResult result)
Creates a new LDAP result object based on the provided result.

Parameters:
result - The LDAP result object to use to initialize this result.

LDAPResult

public LDAPResult(int messageID,
                  ResultCode resultCode)
Creates a new LDAP result object with the provided message ID and result code, and no other information.

Parameters:
messageID - The message ID for the LDAP message that is associated with this LDAP result.
resultCode - The result code from the response.

LDAPResult

public LDAPResult(int messageID,
                  ResultCode resultCode,
                  java.lang.String diagnosticMessage,
                  java.lang.String matchedDN,
                  java.lang.String[] referralURLs,
                  Control[] responseControls)
Creates a new LDAP result object with the provided information.

Parameters:
messageID - The message ID for the LDAP message that is associated with this LDAP result.
resultCode - The result code from the response.
diagnosticMessage - The diagnostic message from the response, if available.
matchedDN - The matched DN from the response, if available.
referralURLs - The set of referral URLs from the response, if available.
responseControls - The set of controls from the response, if available.

LDAPResult

public LDAPResult(int messageID,
                  ResultCode resultCode,
                  java.lang.String diagnosticMessage,
                  java.lang.String matchedDN,
                  java.util.List<java.lang.String> referralURLs,
                  java.util.List<Control> responseControls)
Creates a new LDAP result object with the provided information.

Parameters:
messageID - The message ID for the LDAP message that is associated with this LDAP result.
resultCode - The result code from the response.
diagnosticMessage - The diagnostic message from the response, if available.
matchedDN - The matched DN from the response, if available.
referralURLs - The set of referral URLs from the response, if available.
responseControls - The set of controls from the response, if available.
Method Detail

getMessageID

public final int getMessageID()
Retrieves the message ID for the LDAP message with which this LDAP result is associated.

Specified by:
getMessageID in interface LDAPResponse
Returns:
The message ID for the LDAP message with which this LDAP result is associated.

getResultCode

public final ResultCode getResultCode()
Retrieves the result code from the response.

Returns:
The result code from the response.

getDiagnosticMessage

public final java.lang.String getDiagnosticMessage()
Retrieves the diagnostic message from the response, if available.

Returns:
The diagnostic message from the response, or null if none was provided.

getMatchedDN

public final java.lang.String getMatchedDN()
Retrieves the matched DN from the response, if available.

Returns:
The matched DN from the response, or null if none was provided.

getReferralURLs

public final java.lang.String[] getReferralURLs()
Retrieves the set of referral URLs from the response, if available.

Returns:
The set of referral URLs from the response. The array returned may be empty if the response did not include any referral URLs.

getResponseControls

public final Control[] getResponseControls()
Retrieves the set of controls from the response, if available. Individual response controls of a specific type may be retrieved and decoded using the get method in the response control class.

Returns:
The set of controls from the response. The array returned may be empty if the response did not include any controls.

hasResponseControl

public final boolean hasResponseControl()
Indicates whether this result contains at least one control.

Returns:
true if this result contains at least one control, or false if not.

hasResponseControl

public final boolean hasResponseControl(java.lang.String oid)
Indicates whether this result contains at least one control with the specified OID.

Parameters:
oid - The object identifier for which to make the determination. It must not be null.
Returns:
true if this result contains at least one control with the specified OID, or false if not.

getResponseControl

public final Control getResponseControl(java.lang.String oid)
Retrieves the response control with the specified OID. If there is more than one response control with the specified OID, then the first will be returned.

Parameters:
oid - The OID for the response control to retrieve.
Returns:
The requested response control, or null if there is no such response control.

toString

public java.lang.String toString()
Retrieves a string representation of this LDAP result.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this LDAP result.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP result to the provided buffer.

Specified by:
toString in interface LDAPResponse
Parameters:
buffer - The buffer to which to append a string representation of this LDAP result.