Example usage for javax.naming.ldap LdapContext equals

List of usage examples for javax.naming.ldap LdapContext equals

Introduction

In this page you can find the example usage for javax.naming.ldap LdapContext equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.springframework.ldap.pool.DelegatingLdapContext.java

/**
 * @see java.lang.Object#equals(java.lang.Object)
 *///  ww  w.j  av a2s  .  c  om
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof LdapContext)) {
        return false;
    }

    final LdapContext thisLdapContext = this.getInnermostDelegateLdapContext();
    LdapContext otherLdapContext = (LdapContext) obj;
    if (otherLdapContext instanceof DelegatingLdapContext) {
        otherLdapContext = ((DelegatingLdapContext) otherLdapContext).getInnermostDelegateLdapContext();
    }

    return thisLdapContext == otherLdapContext
            || (thisLdapContext != null && thisLdapContext.equals(otherLdapContext));
}