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/IPv4.java b/src/main/java/net/onrc/onos/core/util/IPv4.java
index a7f3d24..b25099a 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4.java
@@ -8,11 +8,12 @@
/**
* The class representing an IPv4 address.
+ * This class is immutable.
*/
@JsonDeserialize(using = IPv4Deserializer.class)
@JsonSerialize(using = IPv4Serializer.class)
-public class IPv4 {
- private int value;
+public final class IPv4 {
+ private final int value;
/**
* Default constructor.
@@ -67,15 +68,6 @@
}
/**
- * Set the value of the IPv4 address.
- *
- * @param value the value to set.
- */
- public void setValue(int value) {
- this.value = value;
- }
-
- /**
* Convert the IPv4 value to a '.' separated string.
*
* @return the IPv4 value as a '.' separated string.