Clean up instance checks and casts
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / serialization / match / TcpSourcePortEntrySerializer.java
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