Bug 5540 - ConvertorManager optimization, concurrency
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / ConvertorExecutor.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
10
11 import java.util.Optional;
12 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
13
14 public interface ConvertorExecutor {
15     /**
16      * Lookup and use convertor by specified type, then converts source and returns converted result
17      *
18      * @param <FROM> the source type
19      * @param <TO>   the result type
20      * @param source the source
21      * @return the result (can be empty, if no convertor was found)
22      */
23     <FROM, TO> Optional<TO> convert(final FROM source);
24
25     /**
26      * Lookup and use convertor by specified type, then converts source and returns converted result
27      *
28      * @param <FROM> the source type
29      * @param <TO>   the result type
30      * @param <DATA> the data type
31      * @param source the source
32      * @param data   convertor data
33      * @return the result (can be empty, if no convertor was found)
34      */
35     <FROM, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, final DATA data);
36 }