2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
11 import java.util.Collection;
12 import java.util.Optional;
13 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
14 import org.opendaylight.yangtools.yang.binding.DataContainer;
16 public interface ConvertorExecutor {
18 * Lookup and use convertor by specified type, then converts source and returns converted result
20 * @param <FROM> the source type
21 * @param <TO> the result type
22 * @param <DATA> 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)
27 <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, final DATA data);
30 * Lookup and use convertor by specified type, then converts source collection and returns converted result
32 * @param <FROM> the source type
33 * @param <TO> the result type
34 * @param <DATA> 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)
39 <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final Collection<FROM> source, final DATA data);