summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPConnectorDescriptionImpl.java')
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPConnectorDescriptionImpl.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPConnectorDescriptionImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPConnectorDescriptionImpl.java
new file mode 100644
index 0000000..fa4b5ed
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPConnectorDescriptionImpl.java
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.transport.tcp;
+
+import org.eclipse.net4j.transport.tcp.TCPConnectorDescription;
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.io.Serializable;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class TCPConnectorDescriptionImpl implements TCPConnectorDescription, Cloneable, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String host;
+
+ private int port = DEFAULT_PORT;
+
+ public TCPConnectorDescriptionImpl()
+ {
+ }
+
+ public String getHost()
+ {
+ return host;
+ }
+
+ public void setHost(String host)
+ {
+ this.host = host;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public String getDisplayName()
+ {
+ return MessageFormat.format("{0}:{1}", host, port);
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException
+ {
+ TCPConnectorDescriptionImpl description = new TCPConnectorDescriptionImpl();
+ description.setHost(host);
+ description.setPort(port);
+ return description;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof TCPConnectorDescription)
+ {
+ TCPConnectorDescription that = (TCPConnectorDescription)obj;
+ return this.port == that.getPort() && ObjectUtil.equals(this.host, that.getHost());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return port ^ host.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getDisplayName();
+ }
+}