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