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;
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
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());
}
}
/**
- * @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();