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