Updated Java types according to new design
diff --git a/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java b/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java
index bda2dc1..0a7b7c5 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/types/VlanPcp.java
@@ -1,5 +1,86 @@
package org.openflow.types;
-public class VlanPcp {
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.openflow.exceptions.OFParseError;
+public class VlanPcp implements OFValueType {
+
+ private static final byte VALIDATION_MASK = 0x07;
+ static final int LENGTH = 1;
+
+ private final byte pcp;
+
+ private VlanPcp(byte pcp) {
+ this.pcp = pcp;
+ }
+
+ public static VlanPcp of(byte pcp) {
+ if ((pcp & VALIDATION_MASK) != pcp)
+ throw new IllegalArgumentException("Illegal VLAN PCP value: " + pcp);
+ return new VlanPcp(pcp);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof VlanPcp))
+ return false;
+ VlanPcp other = (VlanPcp)obj;
+ if (other.pcp != this.pcp)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 20173;
+ return this.pcp * prime;
+ }
+
+ @Override
+ public String toString() {
+ return "0x" + Integer.toHexString(pcp);
+ }
+
+ public byte getValue() {
+ return pcp;
+ }
+
+ @Override
+ public int getLength() {
+ return LENGTH;
+ }
+
+ volatile byte[] bytesCache = null;
+
+ public byte[] getBytes() {
+ if (bytesCache == null) {
+ synchronized (this) {
+ if (bytesCache == null) {
+ bytesCache =
+ new byte[] { pcp };
+ }
+ }
+ }
+ return bytesCache;
+ }
+
+ public static final Serializer<VlanPcp> SERIALIZER_V10 = new SerializerV10();
+ public static final Serializer<VlanPcp> SERIALIZER_V11 = SERIALIZER_V10;
+ public static final Serializer<VlanPcp> SERIALIZER_V12 = SERIALIZER_V10;
+ public static final Serializer<VlanPcp> SERIALIZER_V13 = SERIALIZER_V10;
+
+ private static class SerializerV10 implements OFValueType.Serializer<VlanPcp> {
+
+ @Override
+ public void writeTo(VlanPcp value, ChannelBuffer c) {
+ c.writeShort(value.pcp);
+ }
+
+ @Override
+ public VlanPcp readFrom(ChannelBuffer c) throws OFParseError {
+ return VlanPcp.of((byte)(c.readUnsignedByte() & 0xFF));
+ }
+
+ }
+
}