Merge "Create empty match only once"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / registry / flow / FlowRegistryKeyFactory.java
index 1a9948a2bd1137036ce9af73f678550595784c57..4130bb35ccd9732cc1cea6c40696773a5ea65ee2 100644 (file)
@@ -36,12 +36,13 @@ public class FlowRegistryKeyFactory {
         private final int priority;
         private final BigInteger cookie;
         private final Match match;
+        private static final Match EMPTY_MATCH = new MatchBuilder().build();
 
         public FlowRegistryKeyDto(final Flow flow) {
             //TODO: mandatory flow input values (or default values) should be specified via yang model
             tableId = Preconditions.checkNotNull(flow.getTableId(), "flow tableId must not be null");
             priority = MoreObjects.firstNonNull(flow.getPriority(), OFConstants.DEFAULT_FLOW_PRIORITY);
-            match = flow.getMatch()==null? new MatchBuilder().build(): flow.getMatch();
+            match = flow.getMatch()==null ? EMPTY_MATCH : flow.getMatch();
             cookie = MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
         }