Merge "Device*Registry quickfix - add failed"
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / common / Convertor.java
index 0e94005c07d0234bb0ac2ccc49975f664d750563..91f91d2aac3c19c559aac2a4b6044594cc7c8562 100644 (file)
@@ -8,13 +8,37 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
 
+import java.util.Collection;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+
 /**
  * Converts OpenflowJava to MDSal model and vice versa
  *
  * @param <FROM> type of source
  * @param <TO>   type of result
+ * @param <DATA> the type parameter
  */
-public interface Convertor<FROM, TO> {
+public abstract class Convertor<FROM, TO, DATA extends ConvertorData> {
+    private ConvertorExecutor convertorExecutor;
+
+    /**
+     * Gets convertor manager.
+     *
+     * @return the convertor manager
+     */
+    protected ConvertorExecutor getConvertorExecutor() {
+        return convertorExecutor;
+    }
+
+    /**
+     * Sets convertor manager.
+     *
+     * @param convertorExecutor the convertor manager
+     */
+    public void setConvertorExecutor(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     /**
      * Gets type of convertor, used in
@@ -22,13 +46,14 @@ public interface Convertor<FROM, TO> {
      *
      * @return the type of convertor
      */
-    Class<?> getType();
+    public abstract Collection<Class<? extends DataContainer>> getTypes();
 
     /**
      * Converts source to result
      *
      * @param source source
+     * @param data   convertor data
      * @return converted source
      */
-    TO convert(FROM source);
+    public abstract TO convert(FROM source, DATA data);
 }