refactor openflow types
diff --git a/java_gen/pre-written/pom.xml b/java_gen/pre-written/pom.xml
index d50fce4..4504766 100644
--- a/java_gen/pre-written/pom.xml
+++ b/java_gen/pre-written/pom.xml
@@ -35,6 +35,16 @@
<dependencies>
<dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ClassId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ClassId.java
deleted file mode 100644
index 418ec9f..0000000
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ClassId.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.projectfloodlight.openflow.types;
-
-import org.projectfloodlight.openflow.annotations.Immutable;
-
-@Immutable
-public class ClassId implements OFValueType<ClassId> {
- static final int LENGTH = 4;
- private final int rawValue;
-
- public static final ClassId NO_ClassId = ClassId.of(0xFFFFFFFF);
- public static final ClassId FULL_MASK = ClassId.of(0x00000000);
-
- private ClassId(final int rawValue) {
- this.rawValue = rawValue;
- }
-
- public static ClassId of(final int raw) {
- return new ClassId(raw);
- }
-
- public int getInt() {
- return rawValue;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ClassId other = (ClassId) obj;
- if (rawValue != other.rawValue)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return Integer.toString(rawValue);
- }
-
- @Override
- public ClassId applyMask(ClassId mask) {
- return ClassId.of(this.rawValue & mask.rawValue);
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/L2MulticastId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/L2MulticastId.java
index ff69aed..fcd20d6 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/L2MulticastId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/L2MulticastId.java
@@ -1,15 +1,12 @@
package org.projectfloodlight.openflow.types;
-import org.projectfloodlight.openflow.annotations.Immutable;
+import javax.annotation.concurrent.Immutable;
@Immutable
-public class L2MulticastId implements OFValueType<L2MulticastId> {
+public class L2MulticastId {
static final int LENGTH = 4;
private final int rawValue;
- public static final L2MulticastId NO_ClassId = L2MulticastId.of(0xFFFFFFFF);
- public static final L2MulticastId FULL_MASK = L2MulticastId.of(0x00000000);
-
private L2MulticastId(final int rawValue) {
this.rawValue = rawValue;
}
@@ -22,7 +19,6 @@
return rawValue;
}
- @Override
public int getLength() {
return LENGTH;
}
@@ -53,9 +49,4 @@
public String toString() {
return Integer.toString(rawValue);
}
-
- @Override
- public L2MulticastId applyMask(L2MulticastId mask) {
- return L2MulticastId.of(this.rawValue & mask.rawValue);
- }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
index 76c7011..713db9a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
@@ -1,16 +1,13 @@
package org.projectfloodlight.openflow.types;
import org.jboss.netty.buffer.ChannelBuffer;
-import org.projectfloodlight.openflow.annotations.Immutable;
+import javax.annotation.concurrent.Immutable;
@Immutable
-public class LagId implements OFValueType<LagId> {
+public class LagId {
static final int LENGTH = 4;
private final int rawValue;
- public static final LagId NO_ClassId = LagId.of(0xFFFFFFFF);
- public static final LagId FULL_MASK = LagId.of(0x00000000);
-
private LagId(final int rawValue) {
this.rawValue = rawValue;
}
@@ -23,7 +20,6 @@
return rawValue;
}
- @Override
public int getLength() {
return LENGTH;
}
@@ -55,11 +51,6 @@
return true;
}
- @Override
- public LagId applyMask(LagId mask) {
- return LagId.of(this.rawValue & mask.rawValue);
- }
-
public void write4Bytes(ChannelBuffer c) {
c.writeInt(rawValue);
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/PortType.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/PortType.java
deleted file mode 100644
index 245c321..0000000
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/PortType.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.projectfloodlight.openflow.types;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.projectfloodlight.openflow.exceptions.OFParseError;
-import org.projectfloodlight.openflow.annotations.Immutable;
-
-@Immutable
-public enum PortType implements OFValueType<PortType> {
- PHYSICA((byte)0),
- LAG((byte)1);
-
- private final byte type;
- static final int LENGTH = 1;
-
- public static final PortType NO_MASK = PortType.of((byte)0xFF);
- public static final PortType FULL_MASK = PortType.of((byte)0x00);
-
- private PortType(byte type) {
- this.type = type;
- }
-
- public static PortType of(byte type) {
- switch (type) {
- case 0:
- return PHYSICA;
- case 1:
- return LAG;
- default:
- throw new IllegalArgumentException("Illegal Port Type: " + type);
- }
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public String toString() {
- return Integer.toHexString(type);
- }
-
- @Override
- public PortType applyMask(PortType mask) {
- return PortType.of((byte)(this.type & mask.type));
- }
-
- public void writeByte(ChannelBuffer c) {
- c.writeByte(this.type);
- }
-
- public static PortType readByte(ChannelBuffer c) throws OFParseError {
- return PortType.of((byte)(c.readUnsignedByte()));
- }
-
- public byte getPortType() {
- return type;
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Priority.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Priority.java
deleted file mode 100644
index 5f86cea..0000000
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Priority.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.projectfloodlight.openflow.types;
-
-import org.projectfloodlight.openflow.annotations.Immutable;
-
-@Immutable
-public class Priority implements OFValueType<Priority> {
- static final int LENGTH = 4;
- private final int rawValue;
-
- public static final Priority NO_ClassId = Priority.of(0xFFFFFFFF);
- public static final Priority FULL_MASK = Priority.of(0x00000000);
-
- private Priority(final int rawValue) {
- this.rawValue = rawValue;
- }
-
- public static Priority of(final int raw) {
- return new Priority(raw);
- }
-
- public int getInt() {
- return rawValue;
- }
-
- @Override
- public int getLength() {
- return LENGTH;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Priority other = (Priority) obj;
- if (rawValue != other.rawValue)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return Integer.toString(rawValue);
- }
-
- @Override
- public Priority applyMask(Priority mask) {
- return Priority.of(this.rawValue & mask.rawValue);
- }
-}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
index 641f40a..cda5699 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
@@ -1,7 +1,7 @@
package org.projectfloodlight.openflow.types;
import org.jboss.netty.buffer.ChannelBuffer;
-import org.projectfloodlight.openflow.annotations.Immutable;
+import javax.annotation.concurrent.Immutable;
@Immutable
public class VRF implements OFValueType<VRF> {