Update MRI projects for Aluminium
[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.Collection;
12 import java.util.Map;
13 import java.util.Optional;
14 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
15
16 public interface ConvertorExecutor {
17     /**
18      * Lookup and use convertor by specified type, then converts source and returns converted result.
19      *
20      * @param <F> the source type
21      * @param <T>   the result type
22      * @param <D> the data type
23      * @param source the source
24      * @param data   convertor data
25      * @return the result (can be empty, if no convertor was found)
26      */
27     <F, T, D extends ConvertorData> Optional<T> convert(F source, D data);
28
29     /**
30      * Lookup and use convertor by specified type, then converts source collection and returns converted result.
31      *
32      * @param <F> the source type
33      * @param <T>   the result type
34      * @param <D> the data type
35      * @param source the source collection
36      * @param data   convertor data
37      * @return the result (can be empty, if no convertor was found)
38      */
39     <F, T, D extends ConvertorData> Optional<T> convert(Collection<F> source, D data);
40
41     /**
42      * Lookup and use convertor by specified type, then converts source collection and returns converted result.
43      *
44      * @param <K> the source key type
45      * @param <F> the source value type
46      * @param <T>   the result type
47      * @param <D> the data type
48      * @param source the source collection
49      * @param data   convertor data
50      * @return the result (can be empty, if no convertor was found)
51      */
52     <K, F, T, D extends ConvertorData> Optional<T> convert(Map<K, F> source, D data);
53 }