Example usage for javax.naming.directory DirContext equals

List of usage examples for javax.naming.directory DirContext equals

Introduction

In this page you can find the example usage for javax.naming.directory DirContext 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.DelegatingDirContext.java

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

    final DirContext thisDirContext = this.getInnermostDelegateDirContext();
    DirContext otherDirContext = (DirContext) obj;
    if (otherDirContext instanceof DelegatingDirContext) {
        otherDirContext = ((DelegatingDirContext) otherDirContext).getInnermostDelegateDirContext();
    }

    return thisDirContext == otherDirContext
            || (thisDirContext != null && thisDirContext.equals(otherDirContext));
}