Update MRI projects for Aluminium
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / serialization / instructions / AbstractActionInstructionSerializer.java
index 0de90d0fde94faafcb164636e9525203e3d0e963..c67ee0e627fe1f68238a1de491f2531d8f0f79bb 100644 (file)
@@ -19,27 +19,29 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Ord
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
 
-public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer implements SerializerRegistryInjector {
+public abstract class AbstractActionInstructionSerializer<T extends Instruction>
+        extends AbstractInstructionSerializer<T> implements SerializerRegistryInjector {
 
     private SerializerRegistry registry;
 
     @Override
-    public void serialize(Instruction input, ByteBuf outBuffer) {
+    public void serialize(T input, ByteBuf outBuffer) {
         outBuffer.writeShort(getType());
     }
 
     /**
-     * Try to write list of OpenFlowPlugin actions to output buffer
+     * Try to write list of OpenFlowPlugin actions to output buffer.
+     *
      * @param actions List of OpenFlowPlugin actions
      * @param outBuffer output buffer
      * @param startIndex start index of byte buffer
      */
     protected void writeActions(ActionList actions, short version, ByteBuf outBuffer, int startIndex) {
-        Optional.ofNullable(actions).flatMap(as -> Optional.ofNullable(as.getAction())).map(as -> {
-            int lengthIndex = outBuffer.writerIndex();
+        Optional.ofNullable(actions).flatMap(as -> Optional.ofNullable(as.nonnullAction())).map(as -> {
+            final int lengthIndex = outBuffer.writerIndex();
             outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
             outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
-            as.stream().sorted(OrderComparator.build()).forEach(a -> ActionUtil
+            as.values().stream().sorted(OrderComparator.build()).forEach(a -> ActionUtil
                     .writeAction(a.getAction(), version, registry, outBuffer));
             outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
             return actions;