Change some of the basic classes in the "unit/" directory to immutable:
* Change each class to "final"
* Change the fields to "final"
* Remove the "set" methods
Change-Id: I3499489024403b55328ffb1827fc8c3b5ffd231e
diff --git a/src/main/java/net/onrc/onos/core/util/IPv6.java b/src/main/java/net/onrc/onos/core/util/IPv6.java
index 38a86b5..986fd11 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv6.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv6.java
@@ -9,12 +9,13 @@
/**
* The class representing an IPv6 address.
+ * This class is immutable.
*/
@JsonDeserialize(using = IPv6Deserializer.class)
@JsonSerialize(using = IPv6Serializer.class)
-public class IPv6 {
- private long valueHigh; // The higher (more significant) 64 bits
- private long valueLow; // The lower (less significant) 64 bits
+public final class IPv6 {
+ private final long valueHigh; // The higher (more significant) 64 bits
+ private final long valueLow; // The lower (less significant) 64 bits
/**
* Default constructor.
@@ -67,15 +68,6 @@
}
/**
- * Set the value of the higher (more significant) 64 bits of the address.
- *
- * @param valueHigh the higher (more significant) 64 bits of the address.
- */
- public void setValueHigh(long valueHigh) {
- this.valueHigh = valueHigh;
- }
-
- /**
* Get the value of the lower (less significant) 64 bits of the address.
*
* @return the value of the lower (less significant) 64 bits of the
@@ -86,26 +78,6 @@
}
/**
- * Get the value of the lower (less significant) 64 bits of the address.
- *
- * @param valueLow the lower (less significant) 64 bits of the address.
- */
- public void setValueLow(long valueLow) {
- this.valueLow = valueLow;
- }
-
- /**
- * Set the value of the IPv6 address.
- *
- * @param valueHigh the higher (more significant) 64 bits of the address.
- * @param valueLow the lower (less significant) 64 bits of the address.
- */
- public void setValue(long valueHigh, long valueLow) {
- this.valueHigh = valueHigh;
- this.valueLow = valueLow;
- }
-
- /**
* Convert the IPv6 value to a ':' separated string.
*
* @return the IPv6 value as a ':' separated string.