add id to node
[jSite2.git] / src / net / pterodactylus / jsite / core / Node.java
index 9435995..5a8ec89 100644 (file)
@@ -28,7 +28,6 @@ import net.pterodactylus.util.beans.AbstractBean;
  * {@link PropertyChangeListener}s if any of the contained properties change.
  * 
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- * @version $Id$
  */
 public class Node extends AbstractBean {
 
@@ -41,6 +40,9 @@ public class Node extends AbstractBean {
        /** Name of the “port” property. */
        public static final String PROPERTY_PORT = "port";
 
+       /** Internal ID. */
+       private String id;
+
        /** The name of the node. */
        private String name;
 
@@ -50,9 +52,24 @@ public class Node extends AbstractBean {
        /** The port number of the node. */
        private int port;
 
-       //
-       // EVENT MANAGEMENT
-       //
+       /**
+        * Returns the internal ID of the node.
+        * 
+        * @return The internal ID of the node
+        */
+       String getId() {
+               return id;
+       }
+
+       /**
+        * Sets the internal ID of the node.
+        * 
+        * @param id
+        *            The internal ID of the node
+        */
+       void setId(String id) {
+               this.id = id;
+       }
 
        /**
         * Returns the user-given name of the node.
@@ -72,9 +89,7 @@ public class Node extends AbstractBean {
        public void setName(String name) {
                String oldName = this.name;
                this.name = name;
-               if (!equal(oldName, name)) {
-                       firePropertyChange(PROPERTY_NAME, oldName, name);
-               }
+               fireIfPropertyChanged(PROPERTY_NAME, oldName, name);
        }
 
        /**
@@ -95,9 +110,7 @@ public class Node extends AbstractBean {
        public void setHostname(String hostname) {
                String oldHostname = this.hostname;
                this.hostname = hostname;
-               if (!equal(oldHostname, hostname)) {
-                       firePropertyChange(PROPERTY_HOSTNAME, oldHostname, hostname);
-               }
+               fireIfPropertyChanged(PROPERTY_HOSTNAME, oldHostname, hostname);
        }
 
        /**
@@ -118,9 +131,7 @@ public class Node extends AbstractBean {
        public void setPort(int port) {
                int oldPort = this.port;
                this.port = port;
-               if (oldPort != port) {
-                       firePropertyChange(PROPERTY_PORT, oldPort, port);
-               }
+               fireIfPropertyChanged(PROPERTY_PORT, oldPort, port);
        }
 
        /**