Merge "Device*Registry quickfix - add failed"
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / TableFeaturesResponseConvertor.java
index 63e53a1de74f0ee3a071353770cd47589ada96e1..04c7e72ef5e5eb3377faa0f4b1baceeec5faae5d 100644 (file)
@@ -12,12 +12,15 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
@@ -162,6 +165,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -171,15 +175,17 @@ import org.slf4j.LoggerFactory;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<TableFeatures>> salFeatures = ConvertorManager.getInstance().convert(ofTableFeatures);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<TableFeatures>> salFeatures = convertorManager.convert(ofTableFeatures, data);
  * }
  * </pre>
  */
-public class TableFeaturesResponseConvertor implements Convertor<MultipartReplyTableFeatures, List<TableFeatures>> {
+public class TableFeaturesResponseConvertor extends Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
     private static final Logger LOG = LoggerFactory.getLogger(TableFeaturesResponseConvertor.class);
     private static final Map<TableFeaturesPropType, ActionExecutor> TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION;
     private static final Map<Class<?>, org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> OF_TO_SAL_ACTION;
     private static final Map<Class<? extends MatchField>, Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField>> OF_TO_SAL_TABLE_FEATURE_PROPERTIES;
+    private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(MultipartReplyTableFeatures.class);
 
     static {
         final Builder<TableFeaturesPropType, ActionExecutor> builder = ImmutableMap.builder();
@@ -481,12 +487,12 @@ public class TableFeaturesResponseConvertor implements Convertor<MultipartReplyT
     }
 
     @Override
-    public Class<?> getType() {
-        return MultipartReplyTableFeatures.class;
+    public Collection<Class<? extends DataContainer>> getTypes() {
+        return TYPES;
     }
 
     @Override
-    public List<TableFeatures> convert(MultipartReplyTableFeatures source) {
+    public List<TableFeatures> convert(MultipartReplyTableFeatures source, VersionConvertorData data) {
         if (source == null || source.getTableFeatures() == null) {
             return Collections.emptyList();
         }