Clean up instance checks and casts 82/77982/4
authorStephen Kitt <skitt@redhat.com>
Tue, 20 Nov 2018 13:43:26 +0000 (14:43 +0100)
committerArunprakash D <d.arunprakash@ericsson.com>
Thu, 24 Jan 2019 08:34:12 +0000 (08:34 +0000)
Change-Id: Ic343131694d71e5d775bd8519492da153541fb18
Signed-off-by: Stephen Kitt <skitt@redhat.com>
124 files changed:
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractConnectionAdapterStatistics.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpOpEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpSourceHardwareAddressEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpSourceTransportAddressEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpTargetHardwareAddressEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpTargetTransportAddressEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv4DestinationEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv4SourceEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6DestinationEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6ExtHeaderEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6FlabelEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdSllEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdTargetEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdTllEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6SourceEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/SctpDestinationPortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/SctpSourcePortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/TcpDestinationPortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/TcpSourcePortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/UdpDestinationPortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/UdpSourcePortEntryDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetDlDstActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetDlSrcActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetNwDstActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetNwSrcActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetNwTosActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetTpDstActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetTpSrcActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetVlanIdActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/actions/SetVlanPcpActionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/ArpOpEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/ArpSourceHardwareAddressEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/ArpSourceTransportAddressEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/ArpTargetHardwareAddressEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/ArpTargetTransportAddressEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv4DestinationEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv4SourceEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6DestinationEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6ExtHeaderEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6LabelEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6NdSllEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6NdTargetEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6NdTllEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/Ipv6SourceEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/MatchSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/SctpDestinationPortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/SctpSourcePortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/TcpDestinationPortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/TcpSourcePortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/TunnelIpv4DestinationEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/TunnelIpv4SourceEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/UdpDestinationPortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/UdpSourcePortEntrySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/FlowMessageSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/MeterMessageSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/util/ActionUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerFlowMultipartRequestOnTheFlyCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/multilayer/MultiLayerMultipartRequestCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerAggregateFlowMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerExperimenterMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerFlowMultipartRequestOnTheFlyCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerMultipartRequestCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerTableMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/PortDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsService.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/CopyTtlInActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/CopyTtlOutActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/DecMplsTtlActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/DecNwTtlActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/GroupActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/OutputActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PopMplsActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PopPbbActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PopVlanActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PushMplsActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PushPbbActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/PushVlanActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/SetFieldActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/SetMplsTtlActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/SetNwTtlActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/action/SetQueueActionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/ApplyActionsInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/GoToTableInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/MeterInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/WriteActionsInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/WriteMetadataInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpOpEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpSourceHardwareAddressEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpSourceTransportAddressEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpTargetHardwareAddressEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/ArpTargetTransportAddressEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv4DestinationEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv4SourceEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6DestinationEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6ExtHeaderEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6FlabelEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdSllEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdTargetEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6NdTllEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/Ipv6SourceEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/SctpDestinationPortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/SctpSourcePortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/TcpDestinationPortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/TcpSourcePortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/UdpDestinationPortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/match/UdpSourcePortEntryDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/FlowMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/MeterMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyFlowStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerAggregateFlowMultipartServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerExperimenterMultipartServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerFlowServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerGroupServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerMeterServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerPortServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerTableMultipartServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MatchNormalizationUtilTest.java

index 75cf2695c7dc0f47fc92ee27b5634069edea49a7..e1a5ec1661e1256d0014367808c035cbe2551840 100644 (file)
@@ -58,11 +58,11 @@ abstract class AbstractConnectionAdapterStatistics extends AbstractConnectionAda
 
     @Override
     public void consume(final DataObject message) {
-        if (Notification.class.isInstance(message)) {
-            if (!(DisconnectEvent.class.isInstance(message) || SwitchIdleEvent.class.isInstance(message))) {
+        if (message instanceof Notification) {
+            if (!(message instanceof DisconnectEvent || message instanceof SwitchIdleEvent)) {
                 statisticsCounters.incrementCounter(CounterEventTypes.US_MESSAGE_PASS);
             }
-        } else if (OfHeader.class.isInstance(message)) {
+        } else if (message instanceof OfHeader) {
             statisticsCounters.incrementCounter(CounterEventTypes.US_MESSAGE_PASS);
         }
         consumeDeviceMessage(message);
index 8ab3bbe2a4d723c6637ceadd1056a80e1b974dab..422956d20e9f9ba9f84bfc0cc5faa59f1182b4df 100644 (file)
@@ -142,7 +142,7 @@ public final class MultipartReplyTranslatorUtil {
         if (message instanceof MultipartReply) {
             final Optional<ConvertorExecutor> convertor = Optional.ofNullable(convertorExecutor);
             final Optional<TranslatorLibrary> translator = Optional.ofNullable(translatorLibrary);
-            final MultipartReply msg = MultipartReply.class.cast(message);
+            final MultipartReply msg = (MultipartReply) message;
             final OpenflowVersion ofVersion = OpenflowVersion.get(deviceInfo.getVersion());
             final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
             data.setDatapathId(deviceInfo.getDatapathId());
@@ -180,8 +180,8 @@ public final class MultipartReplyTranslatorUtil {
             }
         } else if (message instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
             .MultipartReply) {
-            return Optional.of(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
-                .MultipartReply.class.cast(message).getMultipartReplyBody());
+            return Optional.of(((org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
+                .MultipartReplymessage).getMultipartReplyBody());
         }
 
         LOG.debug("Failed to translate {} for node {}.", message.getImplementedInterface(), deviceInfo);
index 6e181f4e2804b18880b54d964424805e2efdf82e..12f470df70fd408e60ca1adc5a41507e08f857a8 100644 (file)
@@ -499,8 +499,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
         if (Objects.nonNull(implementedInterface) && org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
                 .rev130709.PacketInMessage.class.equals(implementedInterface)) {
             final org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709
-                    .PacketInMessage packetInMessage = org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
-                    .rev130709.PacketInMessage.class.cast(message);
+                    .PacketInMessage packetInMessage = (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
+                .rev130709.PacketInMessage) message;
 
             handlePacketInMessage(packetInMessage, implementedInterface, packetInMessage.getMatch());
             return true;
index 81f793c14ccef7c52b6fb181461385a34625f700..899329d66917bc6cc26f2f691eaa842a32526855 100644 (file)
@@ -27,9 +27,9 @@ public class ArpOpEntryDeserializer extends AbstractMatchEntryDeserializer {
             builder.setLayer3Match(new ArpMatchBuilder()
                 .setArpOp(arpOp)
                 .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)
-            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpOp())) {
-            builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+        } else if (layer3Match instanceof ArpMatch
+            && Objects.isNull(((ArpMatch) layer3Match).getArpOp())) {
+            builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
                 .setArpOp(arpOp)
                 .build());
         } else {
index b37983bd33ad07afa8200ef970680dce3eb66d24..71c24719fa81f0fe06bb7a1682900eeaf1efb841 100644 (file)
@@ -34,9 +34,9 @@ public class ArpSourceHardwareAddressEntryDeserializer extends AbstractMatchEntr
             builder.setLayer3Match(new ArpMatchBuilder()
                 .setArpSourceHardwareAddress(arpBuilder.build())
                 .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)
-            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpSourceHardwareAddress())) {
-            builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+        } else if (layer3Match instanceof ArpMatch
+            && Objects.isNull(((ArpMatch) layer3Match).getArpSourceHardwareAddress())) {
+            builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
                 .setArpSourceHardwareAddress(arpBuilder.build())
                 .build());
         } else {
index 13668646ca44879767dc19f4e7d4d0f2ba684cf5..13dbf1b00a3d0a0ac8e3f5e03390abdd4765a48a 100644 (file)
@@ -28,9 +28,9 @@ public class ArpSourceTransportAddressEntryDeserializer extends AbstractMatchEnt
             builder.setLayer3Match(new ArpMatchBuilder()
                     .setArpSourceTransportAddress(prefix)
                     .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)
-            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpSourceTransportAddress())) {
-            builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+        } else if (layer3Match instanceof ArpMatch
+            && Objects.isNull(((ArpMatch) layer3Match).getArpSourceTransportAddress())) {
+            builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
                     .setArpSourceTransportAddress(prefix)
                     .build());
         } else {
index 595c5f315f1abed1c5ee0552a11dfd7c9bf67ddd..9bb48e2511e1e8c8c8152e966af8d8dba08554d7 100644 (file)
@@ -34,9 +34,9 @@ public class ArpTargetHardwareAddressEntryDeserializer extends AbstractMatchEntr
             builder.setLayer3Match(new ArpMatchBuilder()
                     .setArpTargetHardwareAddress(arpBuilder.build())
                     .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)
-            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpTargetHardwareAddress())) {
-            builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+        } else if (layer3Match instanceof ArpMatch
+            && Objects.isNull(((ArpMatch) layer3Match).getArpTargetHardwareAddress())) {
+            builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
                     .setArpTargetHardwareAddress(arpBuilder.build())
                     .build());
         } else {
index 21dcce7226b87bdfa04521d224517cae0a08334a..a788287219a7e413e23a09be9506cba8fcf1a88a 100644 (file)
@@ -28,9 +28,9 @@ public class ArpTargetTransportAddressEntryDeserializer extends AbstractMatchEnt
             builder.setLayer3Match(new ArpMatchBuilder()
                     .setArpTargetTransportAddress(prefix)
                     .build());
-        } else if (ArpMatch.class.isInstance(layer3Match)
-            && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpTargetTransportAddress())) {
-            builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+        } else if (layer3Match instanceof ArpMatch
+            && Objects.isNull(((ArpMatch) layer3Match).getArpTargetTransportAddress())) {
+            builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
                     .setArpTargetTransportAddress(prefix)
                     .build());
         } else {
index df499ad3a12e47ab1204563cde2f3e06ee125315..118827bc12263db4681f4da7cda3a699cfe8c108 100644 (file)
@@ -48,9 +48,9 @@ public class Ipv4DestinationEntryDeserializer extends AbstractMatchEntryDeserial
             builder.setLayer3Match(new Ipv4MatchBuilder()
                     .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
                     .build());
-        } else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Destination())) {
-            builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
+        } else if (builder.getLayer3Match() instanceof Ipv4Match
+                && Objects.isNull(((Ipv4Match) builder.getLayer3Match()).getIpv4Destination())) {
+            builder.setLayer3Match(new Ipv4MatchBuilder((Ipv4Match) builder.getLayer3Match())
                     .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
                     .build());
         } else {
@@ -65,11 +65,11 @@ public class Ipv4DestinationEntryDeserializer extends AbstractMatchEntryDeserial
                     .setIpv4DestinationAddressNoMask(address)
                     .setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
                     .build());
-        } else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+        } else if (builder.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask
+                && Objects.isNull(((Ipv4MatchArbitraryBitMask) builder.getLayer3Match())
                 .getIpv4DestinationAddressNoMask())) {
-            builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
-                    .getLayer3Match()))
+            builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder((Ipv4MatchArbitraryBitMask) builder
+                .getLayer3Match())
                     .setIpv4DestinationAddressNoMask(address)
                     .setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
                     .build());
index ca95493d8f26dcfe3ef97279979bd3dc1b0b46a5..a063376caa261eec057024b7fd825e24623669fc 100644 (file)
@@ -46,9 +46,9 @@ public class Ipv4SourceEntryDeserializer extends AbstractMatchEntryDeserializer
             builder.setLayer3Match(new Ipv4MatchBuilder()
                     .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
                     .build());
-        } else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Source())) {
-            builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
+        } else if (builder.getLayer3Match() instanceof Ipv4Match
+                && Objects.isNull(((Ipv4Match) builder.getLayer3Match()).getIpv4Source())) {
+            builder.setLayer3Match(new Ipv4MatchBuilder((Ipv4Match) builder.getLayer3Match())
                     .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
                     .build());
         } else {
@@ -63,11 +63,11 @@ public class Ipv4SourceEntryDeserializer extends AbstractMatchEntryDeserializer
                     .setIpv4SourceAddressNoMask(address)
                     .setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
                     .build());
-        } else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+        } else if (builder.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask
+                && Objects.isNull(((Ipv4MatchArbitraryBitMask) builder.getLayer3Match())
                 .getIpv4SourceAddressNoMask())) {
-            builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
-                    .getLayer3Match()))
+            builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder((Ipv4MatchArbitraryBitMask) builder
+                .getLayer3Match())
                     .setIpv4SourceAddressNoMask(address)
                     .setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
                     .build());
index 2642baa8b2f184f424139f9c97b527e8890e832c..06c13072c4b4257daff9cafb204de3b0aa883487 100644 (file)
@@ -47,9 +47,9 @@ public class Ipv6DestinationEntryDeserializer extends AbstractMatchEntryDeserial
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Destination())) {
-            builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+                && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Destination())) {
+            builder.setLayer3Match(new Ipv6MatchBuilder((Ipv6Match) builder.getLayer3Match())
                     .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
                     .build());
         } else {
@@ -64,10 +64,10 @@ public class Ipv6DestinationEntryDeserializer extends AbstractMatchEntryDeserial
                     .setIpv6DestinationAddressNoMask(address)
                     .setIpv6DestinationArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
                     .build());
-        } else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+        } else if (builder.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask
+                && Objects.isNull(((Ipv6MatchArbitraryBitMask) builder.getLayer3Match())
                 .getIpv6DestinationAddressNoMask())) {
-            final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
+            final Ipv6MatchArbitraryBitMask match = (Ipv6MatchArbitraryBitMask) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
                     .setIpv6DestinationAddressNoMask(address)
                     .setIpv6DestinationArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
index f8d155444c2053d736c1d2431f37f4179ae22abd..12f29087a205fe188ea222d011d8b5af4378407a 100644 (file)
@@ -35,9 +35,9 @@ public class Ipv6ExtHeaderEntryDeserializer extends AbstractMatchEntryDeserializ
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6ExtHeader(extHeaderBuilder.build())
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-            && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6ExtHeader())) {
-            final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+            && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6ExtHeader())) {
+            final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchBuilder(match)
                     .setIpv6ExtHeader(extHeaderBuilder.build())
                     .build());
index 81eea64de45b847b33d6d136e8d23e8027c80080..8268101dbf00a36915f5090e34812a2a7ce5b283 100644 (file)
@@ -36,9 +36,9 @@ public class Ipv6FlabelEntryDeserializer extends AbstractMatchEntryDeserializer
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6Label(ipv6labelBuilder.build())
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-            && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Label())) {
-            final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+            && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Label())) {
+            final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchBuilder(match)
                     .setIpv6Label(ipv6labelBuilder.build())
                     .build());
index d452c7212baf7efe822f731620fbc23c66f20964..289ea760e0ab972f7b18b4e2b37cfc05056e7cf6 100644 (file)
@@ -27,9 +27,9 @@ public class Ipv6NdSllEntryDeserializer extends AbstractMatchEntryDeserializer {
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6NdSll(address)
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-            && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdSll())) {
-            final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+            && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdSll())) {
+            final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchBuilder(match)
                     .setIpv6NdSll(address)
                     .build());
index eb51a1b522c0edeb321d91813691fa32dd8adf91..650b2bdc8e8e00297c1f5cc932924192515fe402 100644 (file)
@@ -27,9 +27,9 @@ public class Ipv6NdTargetEntryDeserializer extends AbstractMatchEntryDeserialize
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6NdTarget(address)
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-            && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTarget())) {
-            final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+            && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdTarget())) {
+            final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchBuilder(match)
                     .setIpv6NdTarget(address)
                     .build());
index eecd5b87c153406775dbb23fbdc21ac57f948f1b..97e80bb6da3ed5b57bd91b4f08833dbb81c609b6 100644 (file)
@@ -27,9 +27,9 @@ public class Ipv6NdTllEntryDeserializer extends AbstractMatchEntryDeserializer {
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6NdTll(address)
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-            && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTll())) {
-            final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+            && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdTll())) {
+            final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchBuilder(match)
                     .setIpv6NdTll(address)
                     .build());
index 81be914bd1e71fab4e48123dd5ca72992822f43c..229e0c5aa4c74fbbfd50cb4170017f28eacda483 100644 (file)
@@ -47,9 +47,9 @@ public class Ipv6SourceEntryDeserializer extends AbstractMatchEntryDeserializer
             builder.setLayer3Match(new Ipv6MatchBuilder()
                     .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
                     .build());
-        } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Source())) {
-            builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
+        } else if (builder.getLayer3Match() instanceof Ipv6Match
+                && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Source())) {
+            builder.setLayer3Match(new Ipv6MatchBuilder((Ipv6Match) builder.getLayer3Match())
                     .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
                     .build());
         } else {
@@ -64,10 +64,10 @@ public class Ipv6SourceEntryDeserializer extends AbstractMatchEntryDeserializer
                     .setIpv6SourceAddressNoMask(address)
                     .setIpv6SourceArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
                     .build());
-        } else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
-                && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+        } else if (builder.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask
+                && Objects.isNull(((Ipv6MatchArbitraryBitMask) builder.getLayer3Match())
                 .getIpv6SourceAddressNoMask())) {
-            final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
+            final Ipv6MatchArbitraryBitMask match = (Ipv6MatchArbitraryBitMask) builder.getLayer3Match();
             builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
                     .setIpv6SourceAddressNoMask(address)
                     .setIpv6SourceArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
index 2b7dfbaf279a80f57813609d1eebe2edd9d6cfb1..cb59e0320107f4f6a6ed9978747fd82fb47ddbd8 100644 (file)
@@ -26,9 +26,9 @@ public class SctpDestinationPortEntryDeserializer extends AbstractMatchEntryDese
             builder.setLayer4Match(new SctpMatchBuilder()
                     .setSctpDestinationPort(new PortNumber(port))
                     .build());
-        } else if (SctpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpDestinationPort())) {
-            builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof SctpMatch
+            && Objects.isNull(((SctpMatch) builder.getLayer4Match()).getSctpDestinationPort())) {
+            builder.setLayer4Match(new SctpMatchBuilder((SctpMatch) builder.getLayer4Match())
                     .setSctpDestinationPort(new PortNumber(port))
                     .build());
         } else {
index 286beafc8e2ba7922016a4f2bd82e0dc14b4d0fc..d58b074a0d7b06797bc3c24558df1848d23848ba 100644 (file)
@@ -26,9 +26,9 @@ public class SctpSourcePortEntryDeserializer extends AbstractMatchEntryDeseriali
             builder.setLayer4Match(new SctpMatchBuilder()
                     .setSctpSourcePort(new PortNumber(port))
                     .build());
-        } else if (SctpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpSourcePort())) {
-            builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof SctpMatch
+            && Objects.isNull(((SctpMatch) builder.getLayer4Match()).getSctpSourcePort())) {
+            builder.setLayer4Match(new SctpMatchBuilder((SctpMatch) builder.getLayer4Match())
                     .setSctpSourcePort(new PortNumber(port))
                     .build());
         } else {
index 4b2f248e2818130235097e74296f023763e38c06..51e379a9f1ea800d9c3f60311d5fc71c5abe5d59 100644 (file)
@@ -26,9 +26,9 @@ public class TcpDestinationPortEntryDeserializer extends AbstractMatchEntryDeser
             builder.setLayer4Match(new TcpMatchBuilder()
                     .setTcpDestinationPort(new PortNumber(port))
                     .build());
-        } else if (TcpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpDestinationPort())) {
-            builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof TcpMatch
+            && Objects.isNull(((TcpMatch) builder.getLayer4Match()).getTcpDestinationPort())) {
+            builder.setLayer4Match(new TcpMatchBuilder((TcpMatch) builder.getLayer4Match())
                     .setTcpDestinationPort(new PortNumber(port))
                     .build());
         } else {
index 02daf560c42090a5e18c7a5b361791da421b115f..88dde1e20f9d839938cada35f9223c31a1241670 100644 (file)
@@ -26,9 +26,9 @@ public class TcpSourcePortEntryDeserializer extends AbstractMatchEntryDeserializ
             builder.setLayer4Match(new TcpMatchBuilder()
                     .setTcpSourcePort(new PortNumber(port))
                     .build());
-        } else if (TcpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpSourcePort())) {
-            builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof TcpMatch
+            && Objects.isNull(((TcpMatch) builder.getLayer4Match()).getTcpSourcePort())) {
+            builder.setLayer4Match(new TcpMatchBuilder((TcpMatch) builder.getLayer4Match())
                     .setTcpSourcePort(new PortNumber(port))
                     .build());
         } else {
index 837e4aeb4cc5c4e7ca545c904ea25e431cf19d56..a32af2f007e885c0b58d9d6c6426c0bd359fd51f 100644 (file)
@@ -26,9 +26,9 @@ public class UdpDestinationPortEntryDeserializer extends AbstractMatchEntryDeser
             builder.setLayer4Match(new UdpMatchBuilder()
                     .setUdpDestinationPort(new PortNumber(port))
                     .build());
-        } else if (UdpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpDestinationPort())) {
-            builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof UdpMatch
+            && Objects.isNull(((UdpMatch) builder.getLayer4Match()).getUdpDestinationPort())) {
+            builder.setLayer4Match(new UdpMatchBuilder((UdpMatch) builder.getLayer4Match())
                     .setUdpDestinationPort(new PortNumber(port))
                     .build());
         } else {
index 2139d8bccd0d844e23b06b98f49403049be53fca..70080208a66601e853b9eb05914c5cf046c958f4 100644 (file)
@@ -26,9 +26,9 @@ public class UdpSourcePortEntryDeserializer extends AbstractMatchEntryDeserializ
             builder.setLayer4Match(new UdpMatchBuilder()
                     .setUdpSourcePort(new PortNumber(port))
                     .build());
-        } else if (UdpMatch.class.isInstance(builder.getLayer4Match())
-            && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpSourcePort())) {
-            builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match()))
+        } else if (builder.getLayer4Match() instanceof UdpMatch
+            && Objects.isNull(((UdpMatch) builder.getLayer4Match()).getUdpSourcePort())) {
+            builder.setLayer4Match(new UdpMatchBuilder((UdpMatch) builder.getLayer4Match())
                     .setUdpSourcePort(new PortNumber(port))
                     .build());
         } else {
index 7d8065402cc3e7f7676d80f0e2d5726c6550d15a..1e1d33771be90664adf34a21c2f9217b48b5b16f 100644 (file)
@@ -24,7 +24,7 @@ public class SetDlDstActionSerializer extends AbstractSetFieldActionSerializer {
                 .setSetField(new SetFieldBuilder()
                         .setEthernetMatch(new EthernetMatchBuilder()
                                 .setEthernetDestination(new EthernetDestinationBuilder()
-                                        .setAddress(SetDlDstActionCase.class.cast(input).getSetDlDstAction()
+                                        .setAddress(((SetDlDstActionCase) input).getSetDlDstAction()
                                                 .getAddress())
                                         .build())
                                 .build())
index 5b73b4f1ca83d33ad43b85dcca716a1a02942874..9bad33dd4d7f66fa6b150b6dfd55e186968cee81 100644 (file)
@@ -24,7 +24,7 @@ public class SetDlSrcActionSerializer extends AbstractSetFieldActionSerializer {
                 .setSetField(new SetFieldBuilder()
                         .setEthernetMatch(new EthernetMatchBuilder()
                                 .setEthernetSource(new EthernetSourceBuilder()
-                                        .setAddress(SetDlSrcActionCase.class.cast(input).getSetDlSrcAction()
+                                        .setAddress(((SetDlSrcActionCase) input).getSetDlSrcAction()
                                                 .getAddress())
                                         .build())
                                 .build())
index 19e1af2033895e102fb39e9fee803df3d1df8601..b5c020880217a081cedfc2d3db7ff23a92be5f3d 100644 (file)
@@ -23,16 +23,16 @@ public class SetNwDstActionSerializer extends AbstractSetFieldActionSerializer {
 
     @Override
     protected SetFieldCase buildAction(Action input) {
-        final Address address = SetNwDstActionCase.class.cast(input).getSetNwDstAction().getAddress();
+        final Address address = ((SetNwDstActionCase) input).getSetNwDstAction().getAddress();
         final SetFieldBuilder builder = new SetFieldBuilder();
 
-        if (Ipv4.class.isInstance(address)) {
+        if (address instanceof Ipv4) {
             builder.setLayer3Match(new Ipv4MatchBuilder()
-                    .setIpv4Destination(Ipv4.class.cast(address).getIpv4Address())
+                    .setIpv4Destination(((Ipv4) address).getIpv4Address())
                     .build());
-        } else if (Ipv6.class.isInstance(address)) {
+        } else if (address instanceof Ipv6) {
             builder.setLayer3Match(new Ipv6MatchBuilder()
-                    .setIpv6Destination(Ipv6.class.cast(address).getIpv6Address())
+                    .setIpv6Destination(((Ipv6) address).getIpv6Address())
                     .build());
         }
 
index bafcf4d15c1b663b5bd352015d16e15751a49cac..dc9149724a814a230198a176379c2dfb6eef1fb3 100644 (file)
@@ -23,16 +23,16 @@ public class SetNwSrcActionSerializer extends AbstractSetFieldActionSerializer {
 
     @Override
     protected SetFieldCase buildAction(Action input) {
-        final Address address = SetNwSrcActionCase.class.cast(input).getSetNwSrcAction().getAddress();
+        final Address address = ((SetNwSrcActionCase) input).getSetNwSrcAction().getAddress();
         final SetFieldBuilder builder = new SetFieldBuilder();
 
-        if (Ipv4.class.isInstance(address)) {
+        if (address instanceof Ipv4) {
             builder.setLayer3Match(new Ipv4MatchBuilder()
-                    .setIpv4Source(Ipv4.class.cast(address).getIpv4Address())
+                    .setIpv4Source(((Ipv4) address).getIpv4Address())
                     .build());
-        } else if (Ipv6.class.isInstance(address)) {
+        } else if (address instanceof Ipv6) {
             builder.setLayer3Match(new Ipv6MatchBuilder()
-                    .setIpv6Source(Ipv6.class.cast(address).getIpv6Address())
+                    .setIpv6Source(((Ipv6) address).getIpv6Address())
                     .build());
         }
 
index edce954f1441759e3ed314ac09659909a9fd2c39..7b0199944ee59c223b4151190036644f14c8c412 100644 (file)
@@ -25,7 +25,7 @@ public class SetNwTosActionSerializer extends AbstractSetFieldActionSerializer {
                 .setSetField(new SetFieldBuilder()
                         .setIpMatch(new IpMatchBuilder()
                                 .setIpDscp(new Dscp(
-                                        ActionUtil.tosToDscp(SetNwTosActionCase.class.cast(input)
+                                        ActionUtil.tosToDscp(((SetNwTosActionCase) input)
                                                 .getSetNwTosAction().getTos().shortValue())))
                                 .build())
                         .build())
index f5fb05212ca05fb7d447328010fc540768d31489..0437a0c47fc38610e7e42e7c696127b9006f66ba 100644 (file)
@@ -29,7 +29,7 @@ public class SetTpDstActionSerializer extends AbstractSetFieldActionSerializer {
 
     @Override
     protected SetFieldCase buildAction(Action input) {
-        final SetTpDstAction setTpDstAction = SetTpDstActionCase.class.cast(input).getSetTpDstAction();
+        final SetTpDstAction setTpDstAction = ((SetTpDstActionCase) input).getSetTpDstAction();
         final PortNumber port = setTpDstAction.getPort();
         final SetFieldBuilder builder = new SetFieldBuilder();
 
index dfebf7ef5d96e9a9df3d26fc40d0be5b0c3c6487..669f58f849acdcf002fb14d140b9afedea4ba268 100644 (file)
@@ -29,7 +29,7 @@ public class SetTpSrcActionSerializer extends AbstractSetFieldActionSerializer {
 
     @Override
     protected SetFieldCase buildAction(Action input) {
-        final SetTpSrcAction setTpSrcAction = SetTpSrcActionCase.class.cast(input).getSetTpSrcAction();
+        final SetTpSrcAction setTpSrcAction = ((SetTpSrcActionCase) input).getSetTpSrcAction();
         final PortNumber port = setTpSrcAction.getPort();
         final SetFieldBuilder builder = new SetFieldBuilder();
 
index d2d5b2eff4a0a7133a304cf32c0f6d0ee4edeb72..28e6fd96ba8a06469015d4622e1202a2980e7e0c 100644 (file)
@@ -25,7 +25,7 @@ public class SetVlanIdActionSerializer extends AbstractSetFieldActionSerializer
                         .setVlanMatch(new VlanMatchBuilder()
                                 .setVlanId(new VlanIdBuilder()
                                         .setVlanIdPresent(true)
-                                        .setVlanId(SetVlanIdActionCase.class.cast(input).getSetVlanIdAction()
+                                        .setVlanId(((SetVlanIdActionCase) input).getSetVlanIdAction()
                                                 .getVlanId())
                                         .build())
                                 .build())
index a99d7bb575f34554895c70db450eb94cda13959b..c6d91628f8f23b7e566f99800718efc51043913e 100644 (file)
@@ -22,7 +22,7 @@ public class SetVlanPcpActionSerializer extends AbstractSetFieldActionSerializer
         return new SetFieldCaseBuilder()
                 .setSetField(new SetFieldBuilder()
                         .setVlanMatch(new VlanMatchBuilder()
-                                .setVlanPcp((SetVlanPcpActionCase.class.cast(input).getSetVlanPcpAction().getVlanPcp()))
+                                .setVlanPcp((((SetVlanPcpActionCase) input).getSetVlanPcpAction().getVlanPcp()))
                                 .build())
                         .build())
                 .build();
index 1d38002f91b1a544e6ab6b430842582e9a369b75..abad40e01091555323502572ff69ec8ca3bbb386 100644 (file)
@@ -20,14 +20,14 @@ public class ArpOpEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
+        outBuffer.writeShort(((ArpMatch) match.getLayer3Match()).getArpOp());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && ArpMatch.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
+                && match.getLayer3Match() instanceof ArpMatch
+                && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpOp());
     }
 
     @Override
index 4d8f21bf3b8d6efcb846b9bb0b78f613eeaeb981..563f567b9b4ea6dd2363233bf906d04130753fe7 100644 (file)
@@ -23,7 +23,7 @@ public class ArpSourceHardwareAddressEntrySerializer extends AbstractMatchEntryS
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
         final ArpSourceHardwareAddress arpSourceHardwareAddress =
-                ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress();
+                ((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress();
         writeMacAddress(arpSourceHardwareAddress.getAddress(), outBuffer);
 
         if (getHasMask(match)) {
@@ -37,13 +37,13 @@ public class ArpSourceHardwareAddressEntrySerializer extends AbstractMatchEntryS
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && ArpMatch.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress());
+                && match.getLayer3Match() instanceof ArpMatch
+                && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
-        return Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress().getMask());
+        return Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress().getMask());
     }
 
     @Override
index 3a2e1d2b6f39f8cbfe59108bb1d79b375c236f2c..e34a96821b8d564a0ac446d8591b618f051fcd45 100644 (file)
@@ -22,21 +22,21 @@ public class ArpSourceTransportAddressEntrySerializer extends AbstractMatchEntry
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        writeIpv4Prefix(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress(), outBuffer);
+        writeIpv4Prefix(((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && ArpMatch.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
+                && match.getLayer3Match() instanceof ArpMatch
+                && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
         // Split address to IP and mask
         final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
+                ((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress());
         addressParts.next();
 
         // Check if we have mask
index 13a62d0d067c8e5ab4d9babb00bfda2ab7befaea..7418a12d10df05266837845a8914812a993c5cfc 100644 (file)
@@ -23,7 +23,7 @@ public class ArpTargetHardwareAddressEntrySerializer extends AbstractMatchEntryS
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
         final ArpTargetHardwareAddress arpTargetHardwareAddress =
-                ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress();
+                ((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress();
         writeMacAddress(arpTargetHardwareAddress.getAddress(), outBuffer);
 
         if (getHasMask(match)) {
@@ -37,13 +37,13 @@ public class ArpTargetHardwareAddressEntrySerializer extends AbstractMatchEntryS
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && ArpMatch.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress());
+                && match.getLayer3Match() instanceof ArpMatch
+                && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
-        return Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress().getMask());
+        return Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress().getMask());
     }
 
     @Override
index f26fc48eb96f9066747095d476f371f41a0681b8..8b8f59e24169661960a35a72e1e16390d619e8c7 100644 (file)
@@ -22,21 +22,21 @@ public class ArpTargetTransportAddressEntrySerializer extends AbstractMatchEntry
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        writeIpv4Prefix(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress(), outBuffer);
+        writeIpv4Prefix(((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && ArpMatch.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
+                && match.getLayer3Match() instanceof ArpMatch
+                && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
         // Split address to IP and mask
         final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
+                ((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress());
         addressParts.next();
 
         // Check if we have mask
index 62dfc28f90c3b7fd95a946be7064d4f32807ad40..9ce2860fb15d301579cf13b36433515eee29f84f 100644 (file)
@@ -25,9 +25,9 @@ public class Ipv4DestinationEntrySerializer extends AbstractMatchEntrySerializer
         super.serialize(match, outBuffer);
 
         if (isPrefix(match)) {
-            writeIpv4Prefix(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination(), outBuffer);
+            writeIpv4Prefix(((Ipv4Match) match.getLayer3Match()).getIpv4Destination(), outBuffer);
         } else if (isArbitrary(match)) {
-            final Ipv4MatchArbitraryBitMask ipv4 = Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+            final Ipv4MatchArbitraryBitMask ipv4 = (Ipv4MatchArbitraryBitMask) match.getLayer3Match();
             writeIpv4Address(ipv4.getIpv4DestinationAddressNoMask(), outBuffer);
 
             if (getHasMask(match)) {
@@ -42,10 +42,10 @@ public class Ipv4DestinationEntrySerializer extends AbstractMatchEntrySerializer
     public boolean matchTypeCheck(Match match) {
         if (isPrefix(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
+                    && Objects.nonNull(((Ipv4Match) match.getLayer3Match()).getIpv4Destination());
         } else if (isArbitrary(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+                    && Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv4DestinationAddressNoMask());
         }
 
@@ -57,13 +57,13 @@ public class Ipv4DestinationEntrySerializer extends AbstractMatchEntrySerializer
         if (isPrefix(match)) {
             // Split address to IP and mask
             final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                    Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
+                    ((Ipv4Match) match.getLayer3Match()).getIpv4Destination());
             addressParts.next();
 
             // Check if we have mask
             return addressParts.hasNext() && Integer.parseInt(addressParts.next()) < 32;
         } else if (isArbitrary(match)) {
-            return Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+            return Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv4DestinationArbitraryBitmask());
         }
 
@@ -71,11 +71,11 @@ public class Ipv4DestinationEntrySerializer extends AbstractMatchEntrySerializer
     }
 
     private static boolean isPrefix(Match match) {
-        return Ipv4Match.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv4Match;
     }
 
     private static boolean isArbitrary(Match match) {
-        return Ipv4MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask;
     }
 
     @Override
index abdfd32e7e3c2738c6d68183072d0ff9a23385e5..80c752ca2e86cc13db147a1d23d75a6cc145cc0b 100644 (file)
@@ -25,9 +25,9 @@ public class Ipv4SourceEntrySerializer extends AbstractMatchEntrySerializer {
         super.serialize(match, outBuffer);
 
         if (isPrefix(match)) {
-            writeIpv4Prefix(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source(), outBuffer);
+            writeIpv4Prefix(((Ipv4Match) match.getLayer3Match()).getIpv4Source(), outBuffer);
         } else if (isArbitrary(match)) {
-            final Ipv4MatchArbitraryBitMask ipv4 = Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+            final Ipv4MatchArbitraryBitMask ipv4 = (Ipv4MatchArbitraryBitMask) match.getLayer3Match();
             writeIpv4Address(ipv4.getIpv4SourceAddressNoMask(), outBuffer);
 
             if (getHasMask(match)) {
@@ -42,10 +42,10 @@ public class Ipv4SourceEntrySerializer extends AbstractMatchEntrySerializer {
     public boolean matchTypeCheck(Match match) {
         if (isPrefix(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
+                    && Objects.nonNull(((Ipv4Match) match.getLayer3Match()).getIpv4Source());
         } else if (isArbitrary(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+                    && Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv4SourceAddressNoMask());
         }
 
@@ -57,13 +57,13 @@ public class Ipv4SourceEntrySerializer extends AbstractMatchEntrySerializer {
         if (isPrefix(match)) {
             // Split address to IP and mask
             final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                    Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
+                    ((Ipv4Match) match.getLayer3Match()).getIpv4Source());
             addressParts.next();
 
             // Check if we have mask
             return addressParts.hasNext() && Integer.parseInt(addressParts.next()) < 32;
         } else if (isArbitrary(match)) {
-            return Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+            return Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv4SourceArbitraryBitmask());
         }
 
@@ -71,11 +71,11 @@ public class Ipv4SourceEntrySerializer extends AbstractMatchEntrySerializer {
     }
 
     private static boolean isPrefix(Match match) {
-        return Ipv4Match.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv4Match;
     }
 
     private static boolean isArbitrary(Match match) {
-        return Ipv4MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask;
     }
 
     @Override
index 1db091a6911eb348a4ea73e45dcaa4e9fec3673d..de382ef61d248ba2c31072099a6ed612d39ba0ca 100644 (file)
@@ -24,9 +24,9 @@ public class Ipv6DestinationEntrySerializer extends AbstractMatchEntrySerializer
         super.serialize(match, outBuffer);
 
         if (isPrefix(match)) {
-            writeIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination(), outBuffer);
+            writeIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Destination(), outBuffer);
         } else if (isArbitrary(match)) {
-            final Ipv6MatchArbitraryBitMask ipv6 = Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+            final Ipv6MatchArbitraryBitMask ipv6 = (Ipv6MatchArbitraryBitMask) match.getLayer3Match();
             writeIpv6Address(ipv6.getIpv6DestinationAddressNoMask(), outBuffer);
 
             if (getHasMask(match)) {
@@ -42,11 +42,11 @@ public class Ipv6DestinationEntrySerializer extends AbstractMatchEntrySerializer
     public boolean matchTypeCheck(Match match) {
         if (isPrefix(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination());
+                    && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Destination());
         } else if (isArbitrary(match)) {
 
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+                    && Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv6DestinationAddressNoMask());
         }
 
@@ -56,13 +56,13 @@ public class Ipv6DestinationEntrySerializer extends AbstractMatchEntrySerializer
     @Override
     protected boolean getHasMask(Match match) {
         if (isPrefix(match)) {
-            if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match())
+            if (null != IpConversionUtil.hasIpv6Prefix(((Ipv6Match) match.getLayer3Match())
                     .getIpv6Destination())) {
                 return Objects.nonNull(IpConversionUtil
-                        .extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination()));
+                        .extractIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Destination()));
             }
         } else if (isArbitrary(match)) {
-            return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+            return Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv6DestinationArbitraryBitmask());
         }
 
@@ -70,11 +70,11 @@ public class Ipv6DestinationEntrySerializer extends AbstractMatchEntrySerializer
     }
 
     private static boolean isPrefix(Match match) {
-        return Ipv6Match.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv6Match;
     }
 
     private static boolean isArbitrary(Match match) {
-        return Ipv6MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask;
     }
 
     @Override
index 37f38a346e8fceda6796209f4e91ac13bf25e26a..8928166702b36cae739ac231049f4cc63707c59b 100644 (file)
@@ -22,7 +22,7 @@ public class Ipv6ExtHeaderEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        final Ipv6ExtHeader ipv6ExtHeader = Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader();
+        final Ipv6ExtHeader ipv6ExtHeader = ((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader();
         outBuffer.writeShort(ipv6ExtHeader.getIpv6Exthdr());
 
         if (getHasMask(match)) {
@@ -36,13 +36,13 @@ public class Ipv6ExtHeaderEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && Ipv6Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader());
+                && match.getLayer3Match() instanceof Ipv6Match
+                && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
-        return Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader().getIpv6ExthdrMask());
+        return Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader().getIpv6ExthdrMask());
     }
 
     @Override
index 0f436c6e394052384f09b2a94d5b0b39cc0bd03d..c2886f76958d5c91892fb84bb405c127dcd7097f 100644 (file)
@@ -22,7 +22,7 @@ public class Ipv6LabelEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        final Ipv6Label ipv6Label = Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label();
+        final Ipv6Label ipv6Label = ((Ipv6Match) match.getLayer3Match()).getIpv6Label();
         outBuffer.writeInt(ipv6Label.getIpv6Flabel().getValue().intValue());
 
         if (getHasMask(match)) {
@@ -36,13 +36,13 @@ public class Ipv6LabelEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && Ipv6Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label());
+                && match.getLayer3Match() instanceof Ipv6Match
+                && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Label());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
-        return Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label().getFlabelMask());
+        return Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Label().getFlabelMask());
     }
 
     @Override
index 32cb8fd2e68a47efb2fb4bc9e3b59b729c3442bc..6a5fb413babea803af7a400015d9ddc013f024b6 100644 (file)
@@ -20,14 +20,14 @@ public class Ipv6NdSllEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        writeMacAddress(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll(), outBuffer);
+        writeMacAddress(((Ipv6Match) match.getLayer3Match()).getIpv6NdSll(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && Ipv6Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll());
+                && match.getLayer3Match() instanceof Ipv6Match
+                && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdSll());
     }
 
     @Override
index 325b2ed1d00a9ac401ca12e49ae28d710e129af8..036ab20947ef8dec4e9af25e2f727dc177c66780 100644 (file)
@@ -20,14 +20,14 @@ public class Ipv6NdTargetEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        writeIpv6Address(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget(), outBuffer);
+        writeIpv6Address(((Ipv6Match) match.getLayer3Match()).getIpv6NdTarget(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && Ipv6Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget());
+                && match.getLayer3Match() instanceof Ipv6Match
+                && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdTarget());
     }
 
     @Override
index c004d1030a6d7b5736df08fd654323275f79192a..d83a69689bdfac8fc338e5b600f9caef81065601 100644 (file)
@@ -20,14 +20,14 @@ public class Ipv6NdTllEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        writeMacAddress(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll(), outBuffer);
+        writeMacAddress(((Ipv6Match) match.getLayer3Match()).getIpv6NdTll(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && Ipv6Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll());
+                && match.getLayer3Match() instanceof Ipv6Match
+                && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdTll());
     }
 
     @Override
index 79ed19f07a94e36a44034f292774bff13023d22e..d9be31d7f30be75197de2d9f50ccaa96e4a5f46f 100644 (file)
@@ -24,9 +24,9 @@ public class Ipv6SourceEntrySerializer extends AbstractMatchEntrySerializer {
         super.serialize(match, outBuffer);
 
         if (isPrefix(match)) {
-            writeIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source(), outBuffer);
+            writeIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source(), outBuffer);
         } else if (isArbitrary(match)) {
-            final Ipv6MatchArbitraryBitMask ipv6 = Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+            final Ipv6MatchArbitraryBitMask ipv6 = (Ipv6MatchArbitraryBitMask) match.getLayer3Match();
             writeIpv6Address(ipv6.getIpv6SourceAddressNoMask(), outBuffer);
 
             if (getHasMask(match)) {
@@ -41,11 +41,11 @@ public class Ipv6SourceEntrySerializer extends AbstractMatchEntrySerializer {
     public boolean matchTypeCheck(Match match) {
         if (isPrefix(match)) {
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source());
+                    && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Source());
         } else if (isArbitrary(match)) {
 
             return Objects.nonNull(match.getLayer3Match())
-                    && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+                    && Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv6SourceAddressNoMask());
         }
 
@@ -55,12 +55,12 @@ public class Ipv6SourceEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     protected boolean getHasMask(Match match) {
         if (isPrefix(match)) {
-            if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source())) {
+            if (null != IpConversionUtil.hasIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source())) {
                 return Objects.nonNull(IpConversionUtil
-                        .extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source()));
+                        .extractIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source()));
             }
         } else if (isArbitrary(match)) {
-            return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+            return Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
                     .getIpv6SourceArbitraryBitmask());
         }
 
@@ -68,11 +68,11 @@ public class Ipv6SourceEntrySerializer extends AbstractMatchEntrySerializer {
     }
 
     private static boolean isPrefix(Match match) {
-        return Ipv6Match.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv6Match;
     }
 
     private static boolean isArbitrary(Match match) {
-        return Ipv6MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+        return match.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask;
     }
 
     @Override
index 51b9137a1ddf71d5909a4de00cb3cd2386a6fa2c..26c7323c612207e6c09059a184a3c86625089a02 100644 (file)
@@ -109,7 +109,7 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
 
                         // If entry is experimenter, set experimenter ID to key
                         if (entry.getOxmClass().equals(ExperimenterClass.class)) {
-                            key.setExperimenterId(ExperimenterIdCase.class.cast(entry.getMatchEntryValue())
+                            key.setExperimenterId(((ExperimenterIdCase) entry.getMatchEntryValue())
                                     .getExperimenter().getExperimenter().getValue());
                         }
 
index 0119fc27d978436bcffbc03940c70e906bb0bf4c..ec0c05908954d67ef0fc630cd5b7fb91d3cbba61 100644 (file)
@@ -20,14 +20,14 @@ public class SctpDestinationPortEntrySerializer extends AbstractMatchEntrySerial
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort().getValue());
+        outBuffer.writeShort(((SctpMatch) match.getLayer4Match()).getSctpDestinationPort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && SctpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort());
+                && match.getLayer4Match() instanceof SctpMatch
+                && Objects.nonNull(((SctpMatch) match.getLayer4Match()).getSctpDestinationPort());
     }
 
     @Override
index ed2d244b3b3d118f6399eed99b8d48fe06b63dfa..7a943764dbabd9b575228470bbd3ff75d68b9756 100644 (file)
@@ -20,14 +20,14 @@ public class SctpSourcePortEntrySerializer extends AbstractMatchEntrySerializer
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort().getValue());
+        outBuffer.writeShort(((SctpMatch) match.getLayer4Match()).getSctpSourcePort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && SctpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort());
+                && match.getLayer4Match() instanceof SctpMatch
+                && Objects.nonNull(((SctpMatch) match.getLayer4Match()).getSctpSourcePort());
     }
 
     @Override
index f55ac575fa084548682b60b010810d1de4e45d6c..2c0f969ee61ffc4e842abbb188a2272a6bcdad0f 100644 (file)
@@ -20,14 +20,14 @@ public class TcpDestinationPortEntrySerializer extends AbstractMatchEntrySeriali
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort().getValue());
+        outBuffer.writeShort(((TcpMatch) match.getLayer4Match()).getTcpDestinationPort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && TcpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort());
+                && match.getLayer4Match() instanceof TcpMatch
+                && Objects.nonNull(((TcpMatch) match.getLayer4Match()).getTcpDestinationPort());
     }
 
     @Override
index 4db42845d324b042b9989809c97d5f591a10fe64..6718a306b3a666718890da509096f5107e18a498 100644 (file)
@@ -20,14 +20,14 @@ public class TcpSourcePortEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort().getValue());
+        outBuffer.writeShort(((TcpMatch) match.getLayer4Match()).getTcpSourcePort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && TcpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort());
+                && match.getLayer4Match() instanceof TcpMatch
+                && Objects.nonNull(((TcpMatch) match.getLayer4Match()).getTcpSourcePort());
     }
 
     @Override
index d361a15ca594160d71416871e89754186e8b77c9..3ac22319556bc2f3901be46e2f4cd9209a9e54de 100644 (file)
@@ -23,21 +23,21 @@ public class TunnelIpv4DestinationEntrySerializer extends AbstractMatchEntrySeri
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
         // TODO: Why is this serialization exactly same as in Ipv4DestinationEntrySerializer?
-        writeIpv4Prefix(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination(), outBuffer);
+        writeIpv4Prefix(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
+                && match.getLayer3Match() instanceof TunnelIpv4Match
+                && Objects.nonNull(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
         // Split address to IP and mask
         final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
+                ((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination());
         addressParts.next();
 
         // Check if we have mask
index c47cb666b3e1d73e5af410abff285d3f94be8f8d..0b0124bb6618adb29fd377da910b1f7f63c8725b 100644 (file)
@@ -23,21 +23,21 @@ public class TunnelIpv4SourceEntrySerializer extends AbstractMatchEntrySerialize
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
         // TODO: Why is this serialization exactly same as in Ipv4SourceEntrySerializer?
-        writeIpv4Prefix(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source(), outBuffer);
+        writeIpv4Prefix(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source(), outBuffer);
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer3Match())
-                && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
-                && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
+                && match.getLayer3Match() instanceof TunnelIpv4Match
+                && Objects.nonNull(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source());
     }
 
     @Override
     protected boolean getHasMask(Match match) {
         // Split address to IP and mask
         final Iterator<String> addressParts = IpConversionUtil.splitToParts(
-                TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
+                ((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source());
         addressParts.next();
 
         // Check if we have mask
index f825b1bf36ea8ec93907ccf9b80a9c5178b083dd..c042d27023b6e2ad427ddb30431878f9bebef282 100644 (file)
@@ -20,14 +20,14 @@ public class UdpDestinationPortEntrySerializer extends AbstractMatchEntrySeriali
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort().getValue());
+        outBuffer.writeShort(((UdpMatch) match.getLayer4Match()).getUdpDestinationPort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && UdpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort());
+                && match.getLayer4Match() instanceof UdpMatch
+                && Objects.nonNull(((UdpMatch) match.getLayer4Match()).getUdpDestinationPort());
     }
 
     @Override
index b05120eb85b6fd1a824852cffedf54d236b06a27..0eff223f01324bee8ec44ea43cddcee4098089e9 100644 (file)
@@ -20,14 +20,14 @@ public class UdpSourcePortEntrySerializer extends AbstractMatchEntrySerializer {
     @Override
     public void serialize(Match match, ByteBuf outBuffer) {
         super.serialize(match, outBuffer);
-        outBuffer.writeShort(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort().getValue());
+        outBuffer.writeShort(((UdpMatch) match.getLayer4Match()).getUdpSourcePort().getValue());
     }
 
     @Override
     public boolean matchTypeCheck(Match match) {
         return Objects.nonNull(match.getLayer4Match())
-                && UdpMatch.class.isInstance(match.getLayer4Match())
-                && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort());
+                && match.getLayer4Match() instanceof UdpMatch
+                && Objects.nonNull(((UdpMatch) match.getLayer4Match()).getUdpSourcePort());
     }
 
     @Override
index a11f19e6d3cca0239e0c51a8441d424e3f5c8321..0a86bc0e077a4042de7dea2f70ce9b2cb9c59c29 100644 (file)
@@ -207,9 +207,9 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
      * @return updated instruction or empty
      */
     private static Optional<Instruction> updateInstruction(final Instruction instruction, final Short protocol) {
-        if (ApplyActionsCase.class.isInstance(instruction)) {
+        if (instruction instanceof ApplyActionsCase) {
             return Optional
-                    .ofNullable(ApplyActionsCase.class.cast(instruction).getApplyActions())
+                    .ofNullable(((ApplyActionsCase) instruction).getApplyActions())
                     .flatMap(aa -> Optional.ofNullable(aa.getAction()))
                     .map(as -> new ApplyActionsCaseBuilder()
                             .setApplyActions(new ApplyActionsBuilder()
@@ -233,8 +233,8 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
      * @return updated OpenFlow action
      */
     private static Action updateSetTpActions(Action action, Short protocol) {
-        if (SetTpSrcActionCase.class.isInstance(action.getAction())) {
-            final SetTpSrcActionCase actionCase = SetTpSrcActionCase.class.cast(action.getAction());
+        if (action.getAction() instanceof SetTpSrcActionCase) {
+            final SetTpSrcActionCase actionCase = (SetTpSrcActionCase) action.getAction();
 
             return new ActionBuilder(action)
                     .setAction(new SetTpSrcActionCaseBuilder(actionCase)
@@ -244,8 +244,8 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
                                     .build())
                             .build())
                     .build();
-        } else if (SetTpDstActionCase.class.isInstance(action.getAction())) {
-            final SetTpDstActionCase actionCase = SetTpDstActionCase.class.cast(action.getAction());
+        } else if (action.getAction() instanceof SetTpDstActionCase) {
+            final SetTpDstActionCase actionCase = (SetTpDstActionCase) action.getAction();
 
             return new ActionBuilder(action)
                     .setAction(new SetTpDstActionCaseBuilder(actionCase)
@@ -277,9 +277,9 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
                 .map(i -> {
                     final int[] offset = {0};
 
-                    return ApplyActionsCase.class.isInstance(i.getInstruction())
+                    return i.getInstruction() instanceof ApplyActionsCase
                             ? Optional
-                            .ofNullable(ApplyActionsCase.class.cast(i.getInstruction()).getApplyActions())
+                            .ofNullable(((ApplyActionsCase) i.getInstruction()).getApplyActions())
                             .flatMap(as -> Optional.ofNullable(as.getAction()))
                             .map(a -> a.stream()
                                     .sorted(OrderComparator.build())
@@ -289,13 +289,13 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
 
                                         // If current action is SetVlanId, insert PushVlan action before it and
                                         // update order
-                                        if (SetVlanIdActionCase.class.isInstance(action.getAction())) {
+                                        if (action.getAction() instanceof SetVlanIdActionCase) {
                                             actions.add(new ActionBuilder()
                                                     .setAction(new PushVlanActionCaseBuilder()
                                                             .setPushVlanAction(new PushVlanActionBuilder()
                                                                     .setCfi(new VlanCfi(1))
-                                                                    .setVlanId(SetVlanIdActionCase.class.cast(action
-                                                                            .getAction()).getSetVlanIdAction()
+                                                                    .setVlanId(((SetVlanIdActionCase) action
+                                                                        .getAction()).getSetVlanIdAction()
                                                                             .getVlanId())
                                                                     .setEthernetType(PUSH_VLAN)
                                                                     .setTag(PUSH_VLAN)
@@ -376,7 +376,7 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
                         .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
                                 .rev131026.Instruction::getInstruction)
                         .filter(ApplyActionsCase.class::isInstance)
-                        .map(i -> ApplyActionsCase.class.cast(i).getApplyActions())
+                        .map(i -> ((ApplyActionsCase) i).getApplyActions())
                         .filter(Objects::nonNull)
                         .map(ActionList::getAction)
                         .filter(Objects::nonNull)
index 516359aa6deaeb418d8de1b0f25254f2ffacbe9e..51ac6ce187661a799d50d6079821a2415e59af36 100644 (file)
@@ -65,7 +65,7 @@ public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessa
                             .flatMap(m -> Optional.ofNullable(m.getFlags()))
                             .ifPresent(flags -> Optional.ofNullable(meterBandHeader.getBandType()).ifPresent(type -> {
                                 if (flags.isOfpmbtDrop()) {
-                                    final Drop band = Drop.class.cast(type);
+                                    final Drop band = (Drop) type;
                                     outBuffer.writeShort(MeterBandType.OFPMBTDROP.getIntValue());
 
                                     outBuffer.writeShort(LENGTH_OF_METER_BANDS);
@@ -73,7 +73,7 @@ public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessa
                                     outBuffer.writeInt(band.getDropBurstSize().intValue());
                                     outBuffer.writeZero(PADDING_IN_METER_BAND_DROP);
                                 } else if (flags.isOfpmbtDscpRemark()) {
-                                    final DscpRemark band = DscpRemark.class.cast(type);
+                                    final DscpRemark band = (DscpRemark) type;
                                     outBuffer.writeShort(MeterBandType.OFPMBTDSCPREMARK.getIntValue());
 
                                     outBuffer.writeShort(LENGTH_OF_METER_BANDS);
@@ -82,7 +82,7 @@ public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessa
                                     outBuffer.writeByte(band.getPrecLevel());
                                     outBuffer.writeZero(PADDING_IN_METER_BAND_DSCP_REMARK);
                                 } else if (flags.isOfpmbtExperimenter()) {
-                                    final Experimenter band = Experimenter.class.cast(type);
+                                    final Experimenter band = (Experimenter) type;
 
                                     // TODO: finish experimenter serialization
                                     final ExperimenterIdSerializerKey<Experimenter> key =
index 8fe0dfd6506826b1972ebe3e0dc00afe6175870d..f71a23d2bebe587837e95fbe7e1491cbb3fe737f 100644 (file)
@@ -50,7 +50,7 @@ public final class ActionUtil {
         try {
             Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
                     .flatMap(provider ->
-                            (GeneralExtensionGrouping.class.isInstance(action)
+                            (action instanceof GeneralExtensionGrouping
                                     ? convertExtensionGrouping(provider, (GeneralExtensionGrouping)action, version)
                                     : convertGenericAction(provider, action, version))
                                     .map(ofjAction -> {
@@ -89,7 +89,7 @@ public final class ActionUtil {
         try {
             Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
                     .flatMap(provider ->
-                            (GeneralExtensionGrouping.class.isInstance(action)
+                            (action instanceof GeneralExtensionGrouping
                                     ? convertExtensionGrouping(provider, (GeneralExtensionGrouping)action, version)
                                     : convertGenericAction(provider, action, version))
                                     .map(ofjAction -> {
index d7ee0510358b8690e6718ff6296083021af190fc..8bc579953b9373904db99c1a3e5d7709eca76e2c 100644 (file)
@@ -115,7 +115,7 @@ public abstract class AbstractService<I, O> {
         Preconditions.checkNotNull(input);
 
         final Class<?> requestType = input instanceof DataContainer
-            ? DataContainer.class.cast(input).getImplementedInterface()
+            ? ((DataContainer) input).getImplementedInterface()
             : input.getClass();
 
         getMessageSpy().spyMessage(requestType, MessageSpy.StatisticsGroup.TO_SWITCH_ENTERED);
index 276b33fbba88e48217e1506e81cfbfa7f306b7d3..75b3790a52fe53cfffe5cd98e5032fad6cd7bab0 100644 (file)
@@ -34,12 +34,12 @@ public class MultiLayerFlowMultipartRequestOnTheFlyCallback<T extends OfHeader>
     @Override
     protected boolean isMultipart(OfHeader result) {
         return result instanceof MultipartReply
-            && MultipartReply.class.cast(result).getType().equals(getMultipartType());
+            && ((MultipartReply) result).getType().equals(getMultipartType());
     }
 
     @Override
     protected boolean isReqMore(T result) {
-        return MultipartReply.class.cast(result).getFlags().isOFPMPFREQMORE();
+        return ((MultipartReply) result).getFlags().isOFPMPFREQMORE();
     }
 
     @Override
index 2218580f4a5500bebe000441e2ea2fa7e3940d30..0cf4636fa57b8f5bf19089846c4ae701728cd872 100644 (file)
@@ -33,7 +33,7 @@ public class MultiLayerMultipartRequestCallback<T extends OfHeader> extends Abst
 
     @Override
     protected boolean isReqMore(T result) {
-        final MultipartRequestFlags flags = MultipartReply.class.cast(result).getFlags();
+        final MultipartRequestFlags flags = ((MultipartReply) result).getFlags();
         return Objects.nonNull(flags) && flags.isOFPMPFREQMORE();
     }
 }
index e118a7f1078f976e72cd712ce90057a0ceaafc05..cb24aa446b555999001d096a104bb614c6306fe4 100644 (file)
@@ -66,8 +66,7 @@ public class SingleLayerAggregateFlowMultipartService
                                         .filter(MultipartReplyFlowAggregateStats.class::isInstance)
                                         .map(multipartReplyBody ->
                                                 new AggregatedFlowStatisticsBuilder(
-                                                        MultipartReplyFlowAggregateStats.class
-                                                        .cast(multipartReplyBody))
+                                                    (MultipartReplyFlowAggregateStats) multipartReplyBody)
                                                         .build())
                                         .collect(Collectors.toList())))
                         .build();
index b69525b5c0bfdcbf192c1a0022986dd64ef644b1..493d98056081e6326a02366d0c6984d47dcc83df 100644 (file)
@@ -72,8 +72,7 @@ public class SingleLayerExperimenterMultipartService extends AbstractExperimente
                                 .map(MultipartReply::getMultipartReplyBody)
                                 .filter(MultipartReplyExperimenter.class::isInstance)
                                 .map(experimenter -> new ExperimenterCoreMessageItemBuilder()
-                                    .setExperimenterMessageOfChoice(MultipartReplyExperimenter.class
-                                        .cast(experimenter)
+                                    .setExperimenterMessageOfChoice(((MultipartReplyExperimenter) experimenter)
                                         .getExperimenterMessageOfChoice())
                                     .build())
                                 .collect(Collectors.toList()))
index 5da63e8b35b42db715d45617190062a15dc54edd..49c4eaca16337e10513e0555adf8f9e76dadf42e 100644 (file)
@@ -33,12 +33,12 @@ public class SingleLayerFlowMultipartRequestOnTheFlyCallback<T extends OfHeader>
     @Override
     protected boolean isMultipart(OfHeader result) {
         return result instanceof MultipartReply
-            && MultipartReply.class.cast(result).getMultipartReplyBody() instanceof MultipartReplyFlowStats;
+            && ((MultipartReply) result).getMultipartReplyBody() instanceof MultipartReplyFlowStats;
     }
 
     @Override
     protected boolean isReqMore(T result) {
-        return MultipartReply.class.cast(result).isRequestMore();
+        return ((MultipartReply) result).isRequestMore();
     }
 
     @Override
index 1869715ec964560b010d37219e74b6b4af93e5ff..e4716b884fb40aea8993cd3ba1408278aa2a249e 100644 (file)
@@ -32,6 +32,6 @@ public class SingleLayerMultipartRequestCallback<T extends OfHeader> extends Abs
 
     @Override
     protected boolean isReqMore(T result) {
-        return MultipartReply.class.cast(result).isRequestMore();
+        return ((MultipartReply) result).isRequestMore();
     }
 }
index 497148d499907b63e204ca23a80c28b803aa5d9b..5114b5ef71db2943cd50009ad129a656191486c9 100644 (file)
@@ -87,8 +87,7 @@ public class SingleLayerTableMultipartService extends AbstractTableMultipartServ
                                 .stream()
                                 .map(MultipartReply::getMultipartReplyBody)
                                 .filter(MultipartReplyTableFeatures.class::isInstance)
-                                .flatMap(multipartReplyBody -> MultipartReplyTableFeatures.class
-                                    .cast(multipartReplyBody)
+                                .flatMap(multipartReplyBody -> ((MultipartReplyTableFeatures) multipartReplyBody)
                                     .getTableFeatures()
                                     .stream())
                                 .collect(Collectors.toList()));
index 15a1d43856e820fd0b17b2330344243f0cc0ab43..81f4aeb7af8b39808c8919a224a82bd59144bb4b 100644 (file)
@@ -44,8 +44,7 @@ public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsSer
         return new GetFlowStatisticsOutputBuilder()
             .setFlowAndStatisticsMapList(input
                 .stream()
-                .flatMap(multipartReply -> MultipartReplyFlowStats.class
-                    .cast(multipartReply.getMultipartReplyBody())
+                .flatMap(multipartReply -> ((MultipartReplyFlowStats) multipartReply.getMultipartReplyBody())
                     .getFlowAndStatisticsMapList()
                     .stream())
                 .map(flowAndStatisticsMapList -> {
index 8918f8e39e885d6a3a72e917b1e583a7d5205766..e6eee3eb18f8af83e9110438677b5d6e6ad355a8 100644 (file)
@@ -40,8 +40,7 @@ public class GroupDirectStatisticsService extends AbstractGroupDirectStatisticsS
         return new GetGroupStatisticsOutputBuilder()
             .setGroupStats(input
                 .stream()
-                .flatMap(multipartReply -> MultipartReplyGroupStats.class
-                    .cast(multipartReply.getMultipartReplyBody())
+                .flatMap(multipartReply -> ((MultipartReplyGroupStats) multipartReply.getMultipartReplyBody())
                     .getGroupStats()
                     .stream())
                 .collect(Collectors.toList()))
index c57964983de6bcc927f1f8cb6e979b41060f946d..9bc8b6dfdda262fef510afcccf7fb606321a0688 100644 (file)
@@ -40,8 +40,7 @@ public class MeterDirectStatisticsService extends AbstractMeterDirectStatisticsS
         return  new GetMeterStatisticsOutputBuilder()
             .setMeterStats(input
                 .stream()
-                .flatMap(multipartReply -> MultipartReplyMeterStats.class
-                    .cast(multipartReply.getMultipartReplyBody())
+                .flatMap(multipartReply -> ((MultipartReplyMeterStats) multipartReply.getMultipartReplyBody())
                     .getMeterStats()
                     .stream())
                 .collect(Collectors.toList()))
index f6e886a4606e43f4864cc61b92c86321360a32e2..20179df58ba8edb43fc364eadba149825bb9d005 100644 (file)
@@ -40,8 +40,7 @@ public class PortDirectStatisticsService extends AbstractPortDirectStatisticsSer
         return  new GetNodeConnectorStatisticsOutputBuilder()
             .setNodeConnectorStatisticsAndPortNumberMap(input
                 .stream()
-                .flatMap(multipartReply -> MultipartReplyPortStats.class
-                    .cast(multipartReply.getMultipartReplyBody())
+                .flatMap(multipartReply -> ((MultipartReplyPortStats) multipartReply.getMultipartReplyBody())
                     .getNodeConnectorStatisticsAndPortNumberMap()
                     .stream())
                 .collect(Collectors.toList()))
index 71fdb884fbda06d46afeb9b5ac2e35d8b3ae4b0d..14229ff31704b9b9583c4c98fc61f65593705fb6 100644 (file)
@@ -40,8 +40,7 @@ public class QueueDirectStatisticsService extends AbstractQueueDirectStatisticsS
         return  new GetQueueStatisticsOutputBuilder()
             .setQueueIdAndStatisticsMap(input
                 .stream()
-                .flatMap(multipartReply -> MultipartReplyQueueStats.class
-                    .cast(multipartReply.getMultipartReplyBody())
+                .flatMap(multipartReply -> ((MultipartReplyQueueStats) multipartReply.getMultipartReplyBody())
                     .getQueueIdAndStatisticsMap()
                     .stream())
                 .collect(Collectors.toList()))
index a50f1f1480b20799cce4efa3ce4c527364d2fb0a..1233b70df8fb58b345e375d8275a389e96972589 100644 (file)
@@ -27,7 +27,7 @@ public class CopyTtlInActionDeserializerTest extends AbstractActionDeserializerT
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(CopyTtlInCase.class.isInstance(action));
+        assertTrue(action instanceof CopyTtlInCase);
         assertEquals(0, in.readableBytes());
     }
 
index 25544f8f526dbcb6ea9db9506c15b4942294817d..8664b942d0ab55507f3adb3231a5e51e0fff17d8 100644 (file)
@@ -27,7 +27,7 @@ public class CopyTtlOutActionDeserializerTest extends AbstractActionDeserializer
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(CopyTtlOutCase.class.isInstance(action));
+        assertTrue(action instanceof CopyTtlOutCase);
         assertEquals(0, in.readableBytes());
     }
 
index 13a8eae5e6ec56e0f94999824803cecd7aa44d9e..523b9b55db33784b5658b80a63cbb7d2be44ed83 100644 (file)
@@ -27,7 +27,7 @@ public class DecMplsTtlActionDeserializerTest extends AbstractActionDeserializer
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(DecMplsTtlCase.class.isInstance(action));
+        assertTrue(action instanceof DecMplsTtlCase);
         assertEquals(0, in.readableBytes());
     }
 
index cd1141be22d5b111faf3e5ee86f30a4588c4a1d0..042d972f91ef2e847a1a67a3251e39721e369daf 100644 (file)
@@ -27,7 +27,7 @@ public class DecNwTtlActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(DecNwTtlCase.class.isInstance(action));
+        assertTrue(action instanceof DecNwTtlCase);
         assertEquals(0, in.readableBytes());
     }
 
index e0b71cc85dab452ccaad3b9f4f7b535b78b48df9..2ac12464bbfeb32e3c617b208531cde70b4fc5b6 100644 (file)
@@ -28,8 +28,8 @@ public class GroupActionDeserializerTest extends AbstractActionDeserializerTest
         in.writeInt(groupId);
 
         final Action action = deserializeAction(in);
-        assertTrue(GroupActionCase.class.isInstance(action));
-        assertEquals(groupId, GroupActionCase.class.cast(action).getGroupAction().getGroupId().intValue());
+        assertTrue(action instanceof GroupActionCase);
+        assertEquals(groupId, ((GroupActionCase) action).getGroupAction().getGroupId().intValue());
         assertEquals(0, in.readableBytes());
     }
 
index 0eb2eb780e1c587017c2b51ace7172df404f6547..78dc6e26c4318d1d36b1c8f916fb6cd6132752d3 100644 (file)
@@ -34,9 +34,9 @@ public class OutputActionDeserializerTest extends AbstractActionDeserializerTest
         in.writeZero(ActionConstants.OUTPUT_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(OutputActionCase.class.isInstance(action));
+        assertTrue(action instanceof OutputActionCase);
 
-        final OutputAction outputAction = OutputActionCase.class.cast(action).getOutputAction();
+        final OutputAction outputAction = ((OutputActionCase) action).getOutputAction();
         assertEquals(portNum, InventoryDataServiceUtil.portNumberfromNodeConnectorId(
                 OpenflowVersion.OF13, outputAction.getOutputNodeConnector().getValue()).intValue());
         assertEquals(maxLength, outputAction.getMaxLength().shortValue());
index b25ed21f47ad1e4a24e755d3b8408b0ed0b6cf4b..bfa103a553bb7384b523b6c9a1711a204461b064 100644 (file)
@@ -30,9 +30,9 @@ public class PopMplsActionDeserializerTest extends AbstractActionDeserializerTes
         in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(PopMplsActionCase.class.isInstance(action));
+        assertTrue(action instanceof PopMplsActionCase);
 
-        final PopMplsAction popAction = PopMplsActionCase.class.cast(action).getPopMplsAction();
+        final PopMplsAction popAction = ((PopMplsActionCase) action).getPopMplsAction();
         assertEquals(ethType, popAction.getEthernetType().shortValue());
         assertEquals(0, in.readableBytes());
     }
index e7f526326b9d4d421cf010515c6b927d9e515102..c2475578a120674226ea8db8d3c2c32588d74d52 100644 (file)
@@ -27,7 +27,7 @@ public class PopPbbActionDeserializerTest extends AbstractActionDeserializerTest
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(PopPbbActionCase.class.isInstance(action));
+        assertTrue(action instanceof PopPbbActionCase);
         assertEquals(0, in.readableBytes());
     }
 
index c64334fa6d311b7425a87cd3c870f585aa662d64..c0e5de8d814180276bdfc133615c353772dbc322 100644 (file)
@@ -27,7 +27,7 @@ public class PopVlanActionDeserializerTest extends AbstractActionDeserializerTes
         in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final Action action = deserializeAction(in);
-        assertTrue(PopVlanActionCase.class.isInstance(action));
+        assertTrue(action instanceof PopVlanActionCase);
         assertEquals(0, in.readableBytes());
     }
 
index 0b29e1ea2bc5c14aa6b07542387d27ebcbc7b8f6..1e6c7a73c526057f1bc16bd9136b981d9dda9b41 100644 (file)
@@ -29,8 +29,8 @@ public class PushMplsActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(PushMplsActionCase.class.isInstance(action));
-        assertEquals(ethType, PushMplsActionCase.class.cast(action).getPushMplsAction().getEthernetType().shortValue());
+        assertTrue(action instanceof PushMplsActionCase);
+        assertEquals(ethType, ((PushMplsActionCase) action).getPushMplsAction().getEthernetType().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index f3627b047cfaa694b54266640c9f813eacd77e59..cfa09680c328c95881095b9c902dc32ff5d322a5 100644 (file)
@@ -29,8 +29,8 @@ public class PushPbbActionDeserializerTest extends AbstractActionDeserializerTes
         in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(PushPbbActionCase.class.isInstance(action));
-        assertEquals(ethType, PushPbbActionCase.class.cast(action).getPushPbbAction().getEthernetType().shortValue());
+        assertTrue(action instanceof PushPbbActionCase);
+        assertEquals(ethType, ((PushPbbActionCase) action).getPushPbbAction().getEthernetType().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index 9854425426bc55adcfb25f187e1813102186d98f..98225c30bbb7645d7745a42e46b6b4d72e786f6d 100644 (file)
@@ -29,8 +29,8 @@ public class PushVlanActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(PushVlanActionCase.class.isInstance(action));
-        assertEquals(ethType, PushVlanActionCase.class.cast(action).getPushVlanAction().getEthernetType().shortValue());
+        assertTrue(action instanceof PushVlanActionCase);
+        assertEquals(ethType, ((PushVlanActionCase) action).getPushVlanAction().getEthernetType().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index 644aef2e40984e2af3a69ad40b21416ac05c9936..fcdb910fa102cce844dfd19df6aafcb9c6b2328d 100644 (file)
@@ -36,11 +36,11 @@ public class SetFieldActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeZero(EncodeConstants.SIZE_OF_INT_IN_BYTES);
 
         final Action action = deserializeAction(in);
-        assertTrue(SetFieldCase.class.isInstance(action));
+        assertTrue(action instanceof SetFieldCase);
         assertEquals(
                 OpenflowPortsUtil
                         .getPortLogicalName(EncodeConstants.OF13_VERSION_ID, BinContent.intToUnsignedLong(portNum)),
-                SetFieldCase.class.cast(action).getSetField().getInPort().getValue());
+                ((SetFieldCase) action).getSetField().getInPort().getValue());
         assertEquals(0, in.readableBytes());
     }
 
index 60f03194fd888807b4027ccd6f35d27abfdc2099..d2173640da88a5929fb7f02ba7fb68c60e029017 100644 (file)
@@ -29,8 +29,8 @@ public class SetMplsTtlActionDeserializerTest extends AbstractActionDeserializer
         in.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(SetMplsTtlActionCase.class.isInstance(action));
-        assertEquals(mplsTtl, SetMplsTtlActionCase.class.cast(action).getSetMplsTtlAction().getMplsTtl().shortValue());
+        assertTrue(action instanceof SetMplsTtlActionCase);
+        assertEquals(mplsTtl, ((SetMplsTtlActionCase) action).getSetMplsTtlAction().getMplsTtl().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index 598fe00a8ab0a434349a56f7c431f5b0d245e92e..ec8546b4f66830138d58d9c1d21ad3b876801766 100644 (file)
@@ -29,8 +29,8 @@ public class SetNwTtlActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeZero(ActionConstants.SET_NW_TTL_PADDING);
 
         final Action action = deserializeAction(in);
-        assertTrue(SetNwTtlActionCase.class.isInstance(action));
-        assertEquals(nwTtl, SetNwTtlActionCase.class.cast(action).getSetNwTtlAction().getNwTtl().shortValue());
+        assertTrue(action instanceof SetNwTtlActionCase);
+        assertEquals(nwTtl, ((SetNwTtlActionCase) action).getSetNwTtlAction().getNwTtl().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index 70f26f9ad63bfc0560edc2af6e61e0220925bb3b..6cc48057af23c726f7818353d211ec25a647049a 100644 (file)
@@ -28,8 +28,8 @@ public class SetQueueActionDeserializerTest extends AbstractActionDeserializerTe
         in.writeInt(queueId);
 
         final Action action = deserializeAction(in);
-        assertTrue(SetQueueActionCase.class.isInstance(action));
-        assertEquals(queueId, SetQueueActionCase.class.cast(action).getSetQueueAction().getQueueId().intValue());
+        assertTrue(action instanceof SetQueueActionCase);
+        assertEquals(queueId, ((SetQueueActionCase) action).getSetQueueAction().getQueueId().intValue());
         assertEquals(0, in.readableBytes());
     }
 
index 74dd364ad8fdcc3df7b9cbffa366170f2cb42344..ef81734b0a5030a1b1f56481b84c1d479daf8958 100644 (file)
@@ -56,7 +56,7 @@ public class ApplyActionsInstructionDeserializerTest extends AbstractInstruction
 
         final Instruction instruction = deserializer.deserialize(in);
         assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
-        final ApplyActionsCase actionCase = ApplyActionsCase.class.cast(instruction);
+        final ApplyActionsCase actionCase = (ApplyActionsCase) instruction;
         assertEquals(1, actionCase.getApplyActions().getAction().size());
         assertEquals(PopPbbActionCase.class, actionCase.getApplyActions().getAction().get(0)
                 .getAction().getImplementedInterface());
index 09a2c2957038f016a160ab5147759e2b7f1108cd..cdc8a7e244ada6db31fc6922f481912e93cfa150 100644 (file)
@@ -29,7 +29,7 @@ public class GoToTableInstructionDeserializerTest extends AbstractInstructionDes
 
         final Instruction instruction = deserializeInstruction(in);
         assertEquals(GoToTableCase.class, instruction.getImplementedInterface());
-        assertEquals(tableId, GoToTableCase.class.cast(instruction).getGoToTable().getTableId().shortValue());
+        assertEquals(tableId, ((GoToTableCase) instruction).getGoToTable().getTableId().shortValue());
         assertEquals(0, in.readableBytes());
     }
 
index 5255fca155da88340cbdaa8d633e773639719bad..0b78cb9e8fbbbaf82ab35213a410ca7f3527cd7d 100644 (file)
@@ -28,7 +28,7 @@ public class MeterInstructionDeserializerTest extends AbstractInstructionDeseria
 
         final Instruction instruction = deserializeInstruction(in);
         assertEquals(MeterCase.class, instruction.getImplementedInterface());
-        assertEquals(meterId, MeterCase.class.cast(instruction).getMeter().getMeterId().getValue().intValue());
+        assertEquals(meterId, ((MeterCase) instruction).getMeter().getMeterId().getValue().intValue());
         assertEquals(0, in.readableBytes());
     }
 
index 3dcd2a8964e3a3b0eab58caafc0b695a6aede295..ca7d27fafeb1369b3dcfda7d137c3c51e30f6115 100644 (file)
@@ -56,7 +56,7 @@ public class WriteActionsInstructionDeserializerTest extends AbstractInstruction
 
         final Instruction instruction = deserializer.deserialize(in);
         assertEquals(WriteActionsCase.class, instruction.getImplementedInterface());
-        final WriteActionsCase actionCase = WriteActionsCase.class.cast(instruction);
+        final WriteActionsCase actionCase = (WriteActionsCase) instruction;
         assertEquals(1, actionCase.getWriteActions().getAction().size());
         assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().getAction().get(0)
                 .getAction().getImplementedInterface());
index 2b1bec2ffa1ca3b16e7653f06545a1d0b6bb2adb..9852ae99316ca0f41ca4ba4ce0b654c7e9f76ff2 100644 (file)
@@ -40,14 +40,14 @@ public class WriteMetadataInstructionDeserializerTest extends AbstractInstructio
                 ByteUtil
                         .convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
                 ByteUtil
-                        .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+                        .convertBigIntegerToNBytes(((WriteMetadataCase) instruction).getWriteMetadata()
                                 .getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
 
         assertArrayEquals(
                 ByteUtil
                         .convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
                 ByteUtil
-                        .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+                        .convertBigIntegerToNBytes(((WriteMetadataCase) instruction).getWriteMetadata()
                                 .getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
 
         assertEquals(0, in.readableBytes());
index 4334b580208a05f27159cea68e42f9fc0165e868..3e7b1709e8186b8eaaffcf6d2ce529db56a61ee7 100644 (file)
@@ -27,7 +27,7 @@ public class ArpOpEntryDeserializerTest extends AbstractMatchEntryDeserializerTe
         writeHeader(in, false);
         in.writeShort(arpOp);
 
-        assertEquals(arpOp, ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpOp().intValue());
+        assertEquals(arpOp, ((ArpMatch) deserialize(in).getLayer3Match()).getArpOp().intValue());
         assertEquals(0, in.readableBytes());
     }
 
index c3f29db1d70bc68790f946374f29856a03b04cf1..0d4d3923d3e1ac78fbee24c8b01746cba41dbd63 100644 (file)
@@ -32,7 +32,7 @@ public class ArpSourceHardwareAddressEntryDeserializerTest extends AbstractMatch
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddress));
 
         assertEquals(arpSourceHardwareAddress.getValue(),
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
                         .getValue());
         assertEquals(0, in.readableBytes());
 
@@ -41,7 +41,7 @@ public class ArpSourceHardwareAddressEntryDeserializerTest extends AbstractMatch
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddressMask));
 
         final ArpSourceHardwareAddress desAddress =
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress();
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress();
         assertEquals(arpSourceHardwareAddress.getValue(), desAddress.getAddress().getValue());
         assertEquals(arpSourceHardwareAddressMask.getValue(), desAddress.getMask().getValue());
         assertEquals(0, in.readableBytes());
index dc83ae1f3b2fe349db77a35bf70b2ec3e4dcd440..666df7a686d63d06e341c5bb44fbb64a70d77972 100644 (file)
@@ -36,7 +36,7 @@ public class ArpSourceTransportAddressEntryDeserializerTest extends AbstractMatc
         in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
 
         assertEquals(arpSourceTransportAddressNoMask.getValue(),
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceTransportAddress().getValue());
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceTransportAddress().getValue());
         assertEquals(0, in.readableBytes());
 
         writeHeader(in, true);
@@ -45,7 +45,7 @@ public class ArpSourceTransportAddressEntryDeserializerTest extends AbstractMatc
         in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
 
         final Ipv4Prefix desAddress =
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceTransportAddress();
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceTransportAddress();
         assertEquals(arpSourceTransportAddress.getValue(), desAddress.getValue());
         assertEquals(0, in.readableBytes());
     }
index 1188ade3b26990a30e666aed13ffc778515f6ef6..123f9f1353e383789e6d74fe9dba3099a4a8bcde 100644 (file)
@@ -32,7 +32,7 @@ public class ArpTargetHardwareAddressEntryDeserializerTest extends AbstractMatch
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddress));
 
         assertEquals(arpTargetHardwareAddress.getValue(),
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
                         .getValue());
         assertEquals(0, in.readableBytes());
 
@@ -41,7 +41,7 @@ public class ArpTargetHardwareAddressEntryDeserializerTest extends AbstractMatch
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddressMask));
 
         final ArpTargetHardwareAddress desAddress =
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress();
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress();
         assertEquals(arpTargetHardwareAddress.getValue(), desAddress.getAddress().getValue());
         assertEquals(arpTargetHardwareAddressMask.getValue(), desAddress.getMask().getValue());
         assertEquals(0, in.readableBytes());
index 67d1b7200c2370f69fefc5cdb9247520ce296a8a..a783c9b67b27c77abc0a1ed5f25d3a8edabd177e 100644 (file)
@@ -36,7 +36,7 @@ public class ArpTargetTransportAddressEntryDeserializerTest extends AbstractMatc
         in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
 
         assertEquals(arpTargetTransportAddressNoMask.getValue(),
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetTransportAddress().getValue());
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetTransportAddress().getValue());
         assertEquals(0, in.readableBytes());
 
         writeHeader(in, true);
@@ -45,7 +45,7 @@ public class ArpTargetTransportAddressEntryDeserializerTest extends AbstractMatc
         in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
 
         final Ipv4Prefix desAddress =
-                ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetTransportAddress();
+                ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetTransportAddress();
         assertEquals(arpTargetTransportAddress.getValue(), desAddress.getValue());
         assertEquals(0, in.readableBytes());
     }
index 5360d05ef2c45f5c5ed1cd6ec54ede1b82702b5e..58c8265ff025d5cbee45e6f2dae4304f58e06221 100644 (file)
@@ -35,7 +35,7 @@ public class Ipv4DestinationEntryDeserializerTest extends AbstractMatchEntryDese
         in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
         in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
 
-        final Ipv4Match match = Ipv4Match.class.cast(deserialize(in).getLayer3Match());
+        final Ipv4Match match = (Ipv4Match) deserialize(in).getLayer3Match();
 
         assertEquals(address.getValue(), match.getIpv4Destination().getValue());
         assertEquals(0, in.readableBytes());
index 3f52d80e861af2687c4671b9a3cf426a1ad93b1d..edd2f6a5308a9f3e0f0dc5013de16fd0c2bc9e8d 100644 (file)
@@ -35,7 +35,7 @@ public class Ipv4SourceEntryDeserializerTest extends AbstractMatchEntryDeseriali
         in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
         in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
 
-        final Ipv4Match match = Ipv4Match.class.cast(deserialize(in).getLayer3Match());
+        final Ipv4Match match = (Ipv4Match) deserialize(in).getLayer3Match();
 
         assertEquals(address.getValue(), match.getIpv4Source().getValue());
         assertEquals(0, in.readableBytes());
index 5be5a2852499a451a39772d29833c5bb12eb25ed..e36bc7db6ba17f6176fe5c4751c2e9e089b699b1 100644 (file)
@@ -31,7 +31,7 @@ public class Ipv6DestinationEntryDeserializerTest extends AbstractMatchEntryDese
         in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
         in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
 
-        final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        final Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
 
         assertEquals(address.getValue(), match.getIpv6Destination().getValue());
         assertEquals(0, in.readableBytes());
index e513893f0434694d50a0d1a2b8e61f23eff34c31..46700669aec1ac5a45678a51ae6b3a601345fe2b 100644 (file)
@@ -28,7 +28,7 @@ public class Ipv6ExtHeaderEntryDeserializerTest extends AbstractMatchEntryDeseri
         writeHeader(in, false);
         in.writeShort(extHeader);
 
-        Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(extHeader, match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
         assertEquals(0, in.readableBytes());
 
@@ -36,7 +36,7 @@ public class Ipv6ExtHeaderEntryDeserializerTest extends AbstractMatchEntryDeseri
         in.writeShort(extHeader);
         in.writeShort(extHeaderMask);
 
-        match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(extHeader, match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
         assertEquals(extHeaderMask, match.getIpv6ExtHeader().getIpv6ExthdrMask().intValue());
         assertEquals(0, in.readableBytes());
index 32150659ae6305a41bfca61cede9f138be57e4e9..1c55074f3764e5a369c072f14e3c5d2e4ce791e8 100644 (file)
@@ -28,7 +28,7 @@ public class Ipv6FlabelEntryDeserializerTest extends AbstractMatchEntryDeseriali
         writeHeader(in, false);
         in.writeInt(flowLabel);
 
-        Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
         assertEquals(0, in.readableBytes());
 
@@ -36,7 +36,7 @@ public class Ipv6FlabelEntryDeserializerTest extends AbstractMatchEntryDeseriali
         in.writeInt(flowLabel);
         in.writeInt(flowLabelMask);
 
-        match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
         assertEquals(flowLabelMask, match.getIpv6Label().getFlabelMask().getValue().intValue());
         assertEquals(0, in.readableBytes());
index 4c4489820cec3abd4718718282f32e199018b47b..2c8e2707e2054bcfe1ccc098d7720322cc9f7536 100644 (file)
@@ -29,7 +29,7 @@ public class Ipv6NdSllEntryDeserializerTest extends AbstractMatchEntryDeserializ
         writeHeader(in, false);
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
 
-        Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(address.getValue(), match.getIpv6NdSll().getValue());
         assertEquals(0, in.readableBytes());
     }
index cbd6d6225c3f2c1962ea1259b01e6a204688eb15..d8131392a94dbe24ed94cd990f5bc0250631dd86 100644 (file)
@@ -30,7 +30,7 @@ public class Ipv6NdTargetEntryDeserializerTest extends AbstractMatchEntryDeseria
         writeHeader(in, false);
         in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(address));
 
-        Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertArrayEquals(
                 IetfInetUtil.INSTANCE.ipv6AddressBytes(address),
                 IetfInetUtil.INSTANCE.ipv6AddressBytes(match.getIpv6NdTarget()));
index c6785a4ec81aac38b136e0adc9dbb5a3ecacc8ef..4ac20ff0afe0174ea72cb40df900abed733af319 100644 (file)
@@ -29,7 +29,7 @@ public class Ipv6NdTllEntryDeserializerTest extends AbstractMatchEntryDeserializ
         writeHeader(in, false);
         in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
 
-        Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
         assertEquals(address.getValue(), match.getIpv6NdTll().getValue());
         assertEquals(0, in.readableBytes());
     }
index 46a3951bb1259ee9da10ba83268ff92a0321ba81..d40e7361a77e0e8cc958321d709f0f9827ff43da 100644 (file)
@@ -31,7 +31,7 @@ public class Ipv6SourceEntryDeserializerTest extends AbstractMatchEntryDeseriali
         in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
         in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
 
-        final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+        final Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
 
         assertEquals(address.getValue(), match.getIpv6Source().getValue());
         assertEquals(0, in.readableBytes());
index f470ad731484f010c31d322f547c865064b1efb4..aa4fd5f21207542f18495e1c3d8d91a485f280c4 100644 (file)
@@ -27,7 +27,7 @@ public class SctpDestinationPortEntryDeserializerTest extends AbstractMatchEntry
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue()
+        assertEquals(port, ((SctpMatch) deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index 713389552537959ec758c302e78499427907593f..b05cc164e2bc7ad8bed85b80d5bb5821e707289b 100644 (file)
@@ -27,7 +27,7 @@ public class SctpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeser
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpSourcePort().getValue()
+        assertEquals(port, ((SctpMatch) deserialize(in).getLayer4Match()).getSctpSourcePort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index 35d64f8046d47ba82b2db4c0fb1eb12c7ae9395a..3a038cd764f8a88245f1660acd98766d3276468b 100644 (file)
@@ -27,7 +27,7 @@ public class TcpDestinationPortEntryDeserializerTest extends AbstractMatchEntryD
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue()
+        assertEquals(port, ((TcpMatch) deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index f0b1725dfacd8bd50e759852f3ca8c1e7ab42c50..31ce7228cc9eef13c02c52e55ca9677616d3908c 100644 (file)
@@ -27,7 +27,7 @@ public class TcpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeseri
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpSourcePort().getValue()
+        assertEquals(port, ((TcpMatch) deserialize(in).getLayer4Match()).getTcpSourcePort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index 5eb9c14ff28625d2a3484c865a71ab899753b5cb..10172200fd387c635a536bc2298390b639978775 100644 (file)
@@ -27,7 +27,7 @@ public class UdpDestinationPortEntryDeserializerTest extends AbstractMatchEntryD
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue()
+        assertEquals(port, ((UdpMatch) deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index 1145b9a1d45a0a0586e173a2ae8eff91ee8b7193..b39392be1c2ab5cebf39ff39e81a0506de82fbf2 100644 (file)
@@ -27,7 +27,7 @@ public class UdpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeseri
         writeHeader(in, false);
         in.writeShort(port);
 
-        assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpSourcePort().getValue()
+        assertEquals(port, ((UdpMatch) deserialize(in).getLayer4Match()).getUdpSourcePort().getValue()
                 .intValue());
         assertEquals(0, in.readableBytes());
     }
index 89837a405e0d70d6e0cfd003ca700e8c48eb8de2..fa74fc899e74dc3533ef5146d2b34d881c4a473d 100644 (file)
@@ -132,7 +132,7 @@ public class FlowMessageDeserializerTest extends AbstractDeserializerTest {
         final Instruction instruction = message.getInstructions().getInstruction().get(0).getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
 
-        final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+        final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
         assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
                 .getAction().getImplementedInterface());
index c1979d99293bccf6bfa9622699949571a4a6e33f..bac0ff6ad032ca6a85deabcd7791fca96fe95039 100644 (file)
@@ -93,7 +93,7 @@ public class MeterMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(Drop.class, dropHeader.getBandType().getImplementedInterface());
         assertTrue(dropHeader.getMeterBandTypes().getFlags().isOfpmbtDrop());
 
-        final Drop drop = Drop.class.cast(dropHeader.getBandType());
+        final Drop drop = (Drop) dropHeader.getBandType();
         assertEquals(DROP_RATE, drop.getDropRate().intValue());
         assertEquals(DROP_BURST, drop.getDropBurstSize().intValue());
 
@@ -102,7 +102,7 @@ public class MeterMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(DscpRemark.class, dscpHeader.getBandType().getImplementedInterface());
         assertTrue(dscpHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark());
 
-        final DscpRemark dscpRemark = DscpRemark.class.cast(dscpHeader.getBandType());
+        final DscpRemark dscpRemark = (DscpRemark) dscpHeader.getBandType();
         assertEquals(DSCP_RATE, dscpRemark.getDscpRemarkRate().intValue());
         assertEquals(DSCP_BURST, dscpRemark.getDscpRemarkBurstSize().intValue());
 
index 8d40c5a2488cbeab84a6d2eed1c16cd62f564e99..041c1c13194d784bbe631f6935511ea9add0a276 100644 (file)
@@ -148,7 +148,7 @@ public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDe
                 flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
 
-        final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+        final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
         assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
                 .getAction().getImplementedInterface());
@@ -157,7 +157,7 @@ public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDe
                 flowAndStatisticsMapList.getInstructions().getInstruction().get(1).getInstruction();
         assertEquals(WriteActionsCase.class, instruction1.getImplementedInterface());
 
-        final WriteActionsCase writeActions = WriteActionsCase.class.cast(instruction1);
+        final WriteActionsCase writeActions = (WriteActionsCase) instruction1;
         assertEquals(1, writeActions.getWriteActions().getAction().size());
         assertEquals(PopVlanActionCase.class, writeActions.getWriteActions().getAction().get(0)
                 .getAction().getImplementedInterface());
index ff882a3405ee5d000636e3c0deff379f8f9c5a7a..b20632245a0815c53b3cfc90693563b929d66799 100644 (file)
@@ -152,7 +152,7 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
                 flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
 
-        final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+        final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
         assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
                 .getAction().getImplementedInterface());
index 8728062a6d248b9f4cf6aeb8dc9fa45f17a496fb..6ecbd795f98cdcdfd12ebd45e9a2a263755c1b4c 100644 (file)
@@ -46,9 +46,9 @@ public class SingleLayerAggregateFlowMultipartServiceTest extends ServiceMocking
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
 
-        final MultipartRequestFlowAggregateStats result = MultipartRequestFlowAggregateStats.class.cast(
-                MultipartRequest.class.cast(ofHeader)
-                        .getMultipartRequestBody());
+        final MultipartRequestFlowAggregateStats result =
+            (MultipartRequestFlowAggregateStats) ((MultipartRequest) ofHeader)
+                .getMultipartRequestBody();
 
         assertEquals(TABLE_ID, result.getFlowAggregateStats().getTableId().shortValue());
     }
index f26bcf16aba09e8816fe2d6e5d4e9a0c1884f71d..8bdd20a47aa791d0765d5f07b79e7e9bfd93fd95 100644 (file)
@@ -43,9 +43,8 @@ public class SingleLayerExperimenterMultipartServiceTest extends ServiceMocking
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
 
-        final MultipartRequestExperimenter result = MultipartRequestExperimenter.class.cast(
-                MultipartRequest.class.cast(ofHeader)
-                        .getMultipartRequestBody());
+        final MultipartRequestExperimenter result = (MultipartRequestExperimenter) ((MultipartRequest) ofHeader)
+            .getMultipartRequestBody();
 
         assertEquals(DummyExperimenter.class, result.getExperimenterMessageOfChoice().getImplementedInterface());
     }
index f563f4aed95ccb2ba069f3c4e538ab4feb1b7c37..534538d6d2aa8cad912fbf23ac844f253c85263f 100644 (file)
@@ -38,7 +38,7 @@ public class SingleLayerFlowServiceTest extends ServiceMocking {
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(FlowMessage.class, ofHeader.getImplementedInterface());
 
-        final FlowMessage result = FlowMessage.class.cast(ofHeader);
+        final FlowMessage result = (FlowMessage) ofHeader;
 
         assertEquals(FlowModCommand.OFPFCADD, result.getCommand());
         assertEquals(TABLE_ID, result.getTableId().shortValue());
index 8a0318c4e77446afdd868051960b925da0a43032..22ba2227671a172a081b53c6d068672f8de62a3c 100644 (file)
@@ -39,7 +39,7 @@ public class SingleLayerGroupServiceTest extends ServiceMocking {
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(GroupMessage.class, ofHeader.getImplementedInterface());
 
-        final GroupMessage result = GroupMessage.class.cast(ofHeader);
+        final GroupMessage result = (GroupMessage) ofHeader;
 
         assertEquals(GroupModCommand.OFPGCADD, result.getCommand());
         assertEquals(GROUP_ID, result.getGroupId().getValue().longValue());
index eab416a9b6a8e5b670fc2be43d9b5796ec4b3d91..3105d12bbc743fc68cc1a4fe613e895a22c18d14 100644 (file)
@@ -39,7 +39,7 @@ public class SingleLayerMeterServiceTest extends ServiceMocking {
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(MeterMessage.class, ofHeader.getImplementedInterface());
 
-        final MeterMessage result = MeterMessage.class.cast(ofHeader);
+        final MeterMessage result = (MeterMessage) ofHeader;
 
         assertEquals(MeterModCommand.OFPMCADD, result.getCommand());
         assertEquals(METER_ID, result.getMeterId().getValue().longValue());
index f92eb160803a5cdb8bff978d494a07c0c794fef1..5a6c917ec93ff30563c1a3c2b1fd9446a846b8ac 100644 (file)
@@ -38,7 +38,7 @@ public class SingleLayerPortServiceTest extends ServiceMocking {
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(PortMessage.class, ofHeader.getImplementedInterface());
 
-        final PortMessage result = PortMessage.class.cast(ofHeader);
+        final PortMessage result = (PortMessage) ofHeader;
 
         assertEquals(PORT_ID, result.getPortNumber().getUint32().longValue());
     }
index a96fcc9f82e59fdf1f2af4f6eab20b25d004ae64..2422bc445e18b3e4d047e07e389af9a2bc67e30b 100644 (file)
@@ -52,9 +52,8 @@ public class SingleLayerTableMultipartServiceTest extends ServiceMocking {
         final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
         assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
 
-        final MultipartRequestTableFeatures result = MultipartRequestTableFeatures.class.cast(
-                MultipartRequest.class.cast(ofHeader)
-                        .getMultipartRequestBody());
+        final MultipartRequestTableFeatures result = (MultipartRequestTableFeatures) ((MultipartRequest) ofHeader)
+            .getMultipartRequestBody();
 
         assertEquals(MAX_ENTRIES, result.getTableFeatures().get(0).getMaxEntries().longValue());
     }
index fd346c478672912bd8c9a483e8686f56bfdfbdf4..49c26c5c7c298ed979855eb97c79601b85b10cd1 100644 (file)
@@ -83,7 +83,7 @@ public class MatchNormalizationUtilTest {
                                 .build())
                         .build()));
 
-        assertEquals(arpOp, ArpMatch.class.cast(matchBuilder.getLayer3Match()).getArpOp().intValue());
+        assertEquals(arpOp, ((ArpMatch) matchBuilder.getLayer3Match()).getArpOp().intValue());
     }
 
     @Test
@@ -98,9 +98,9 @@ public class MatchNormalizationUtilTest {
                         .build()));
 
         assertEquals("192.168.1.0/24",
-                TunnelIpv4Match.class.cast(matchBuilder.getLayer3Match()).getTunnelIpv4Source().getValue());
+                ((TunnelIpv4Match) matchBuilder.getLayer3Match()).getTunnelIpv4Source().getValue());
         assertEquals("192.168.2.0/24",
-                TunnelIpv4Match.class.cast(matchBuilder.getLayer3Match()).getTunnelIpv4Destination().getValue());
+                ((TunnelIpv4Match) matchBuilder.getLayer3Match()).getTunnelIpv4Destination().getValue());
     }
 
     @Test
@@ -114,9 +114,9 @@ public class MatchNormalizationUtilTest {
                         .setIpv4Destination(new Ipv4Prefix(destination))
                         .build()));
 
-        assertEquals("192.168.1.0/24", Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Source().getValue());
+        assertEquals("192.168.1.0/24", ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Source().getValue());
         assertEquals("192.168.2.0/24",
-                Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Destination().getValue());
+                ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Destination().getValue());
     }
 
     @Test
@@ -133,8 +133,8 @@ public class MatchNormalizationUtilTest {
                         .setIpv4DestinationArbitraryBitmask(leftMask)
                         .build()));
 
-        assertEquals(right, Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Source());
-        assertEquals(right, Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Destination());
+        assertEquals(right, ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Source());
+        assertEquals(right, ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Destination());
     }
 
     @Test
@@ -155,11 +155,11 @@ public class MatchNormalizationUtilTest {
                         .setIpv6Destination(leftPrefix)
                         .build()));
 
-        assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdSll());
-        assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTll());
-        assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
-        assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
-        assertEquals(rightAddress, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTarget());
+        assertEquals(rightMac, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdSll());
+        assertEquals(rightMac, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdTll());
+        assertEquals(rightPrefix, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Source());
+        assertEquals(rightPrefix, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Destination());
+        assertEquals(rightAddress, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdTarget());
     }
 
     @Test
@@ -176,8 +176,8 @@ public class MatchNormalizationUtilTest {
                         .setIpv6DestinationArbitraryBitmask(leftMask)
                         .build()));
 
-        assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
-        assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
+        assertEquals(right, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Source());
+        assertEquals(right, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Destination());
     }
 
     @Test