Fix checkstyle violations in openflowjava extensions
[openflowplugin.git] / extension / openflowjava-extension-nicira / src / main / java / org / opendaylight / openflowjava / nx / codec / match / AbstractMatchCodec.java
index 8ca8bf52c32e43e89458acdadce82580bc08b2f3..fe28a3c0e85f4aac56df5df1765988efdada0065 100644 (file)
@@ -9,7 +9,8 @@
 package org.opendaylight.openflowjava.nx.codec.match;
 
 import io.netty.buffer.ByteBuf;
-
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
@@ -18,12 +19,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmC
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
 
-public abstract class AbstractMatchCodec implements OFSerializer<MatchEntry>, OFDeserializer<MatchEntry> {
+public abstract class AbstractMatchCodec implements
+        OFSerializer<MatchEntry>,
+        OFDeserializer<MatchEntry>,
+        HeaderSerializer<MatchEntry>,
+        HeaderDeserializer<MatchEntry> {
 
     protected NxmHeader headerWithMask;
     protected NxmHeader headerWithoutMask;
 
-    protected MatchEntryBuilder deserializeHeader(ByteBuf message) {
+    protected MatchEntryBuilder deserializeHeaderToBuilder(ByteBuf message) {
         MatchEntryBuilder builder = new MatchEntryBuilder();
         builder.setOxmClass(getOxmClass());
         // skip oxm_class - provided
@@ -36,7 +41,13 @@ public abstract class AbstractMatchCodec implements OFSerializer<MatchEntry>, OF
         return builder;
     }
 
-    protected void serializeHeader(MatchEntry input, ByteBuf outBuffer) {
+    @Override
+    public MatchEntry deserializeHeader(ByteBuf message) {
+        return deserializeHeaderToBuilder(message).build();
+    }
+
+    @Override
+    public void serializeHeader(MatchEntry input, ByteBuf outBuffer) {
         outBuffer.writeInt(serializeHeaderToLong(input.isHasMask()).intValue());
     }
 
@@ -62,27 +73,27 @@ public abstract class AbstractMatchCodec implements OFSerializer<MatchEntry>, OF
     }
 
     /**
-     * @return numeric representation of nxm_field
+     * Returns the numeric representation of nxm_field.
      */
     public abstract int getNxmFieldCode();
 
     /**
-     * @return numeric representation of oxm_class
+     * Returns the numeric representation of oxm_class.
      */
     public abstract int getOxmClassCode();
 
     /**
-     * @return match entry value length
+     * Returns the match entry value length.
      */
     public abstract int getValueLength();
 
     /**
-     * @return nxm_field class
+     * Returns the nxm_field class.
      */
     public abstract Class<? extends MatchField> getNxmField();
 
     /**
-     * @return oxm_class class
+     * Returns the oxm_class class.
      */
     public abstract Class<? extends OxmClassBase> getOxmClass();