From e1cd6c2bc4addf80537e31f929118ac8f908ea63 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 23 Mar 2015 14:51:59 +0000
Subject: [PATCH] AutoRefactored javadocs + simplified code in equals()
---
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java | 51 +++++++++++++++++----------------------------------
1 files changed, 17 insertions(+), 34 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
index 7368a1d..1b30d8e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
@@ -22,9 +22,8 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
-
package org.opends.admin.ads.util;
import java.util.LinkedHashSet;
@@ -38,27 +37,20 @@
*/
public class PreferredConnection
{
- private String ldapUrl;
- private Type type;
- /**
- * The type of the connection.
- */
+ /** The type of the connection. */
public enum Type
{
- /**
- * LDAP connection.
- */
+ /** LDAP connection. */
LDAP,
- /**
- * LDAPS connection.
- */
+ /** LDAPS connection. */
LDAPS,
- /**
- * Start TLS connection.
- */
+ /** Start TLS connection. */
START_TLS
}
+ private String ldapUrl;
+ private Type type;
+
/**
* The constructor of the PreferredConnection.
* @param ldapUrl the LDAP URL to connect to the server.
@@ -89,35 +81,26 @@
return type;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int hashCode()
{
return (type+ldapUrl.toLowerCase()).hashCode();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean equals(Object o)
{
- boolean equals = false;
- if (this != o)
+ if (this == o)
{
- if ((o != null) &&
- (o instanceof PreferredConnection))
- {
- PreferredConnection p = (PreferredConnection)o;
- equals = type == p.getType() &&
- ldapUrl.equalsIgnoreCase(p.getLDAPURL());
- }
+ return true;
}
- else
+ if (o instanceof PreferredConnection)
{
- equals = true;
+ PreferredConnection p = (PreferredConnection)o;
+ return type == p.getType()
+ && ldapUrl.equalsIgnoreCase(p.getLDAPURL());
}
- return equals;
+ return false;
}
--
Gitblit v1.10.0