Class ConvertorManager
- java.lang.Object
-
- org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager
-
- All Implemented Interfaces:
ConvertorExecutor,ConvertorRegistrator
public class ConvertorManager extends Object implements ConvertorExecutor, ConvertorRegistrator
Manages various convertors and allows to use them all in one generic way.
-
-
Constructor Summary
Constructors Constructor Description ConvertorManager(Short... supportedVersions)Create new instance of Convertor Manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <F,T,D extends ConvertorData>
Optional<T>convert(F source, D data)Lookup and use convertor by specified type, then converts source and returns converted result.<F,T,D extends ConvertorData>
Optional<T>convert(Collection<F> source, D data)Lookup and use convertor by specified type, then converts source collection and returns converted result.<K,F,T,D extends ConvertorData>
Optional<T>convert(Map<K,F> source, D data)Lookup and use convertor by specified type, then converts source collection and returns converted result.ConvertorManagerregisterConvertor(short version, Convertor<?,?,? extends ConvertorData> convertor)Register convertor.
-
-
-
Constructor Detail
-
ConvertorManager
public ConvertorManager(Short... supportedVersions)
Create new instance of Convertor Manager.- Parameters:
supportedVersions- supported versions
-
-
Method Detail
-
registerConvertor
public ConvertorManager registerConvertor(short version, Convertor<?,?,? extends ConvertorData> convertor)
Description copied from interface:ConvertorRegistratorRegister convertor.- Specified by:
registerConvertorin interfaceConvertorRegistratorconvertor- the convertor
-
convert
public <F,T,D extends ConvertorData> Optional<T> convert(F source, D data)
Description copied from interface:ConvertorExecutorLookup and use convertor by specified type, then converts source and returns converted result.- Specified by:
convertin interfaceConvertorExecutor- Type Parameters:
F- the source typeT- the result typeD- the data type- Parameters:
source- the sourcedata- convertor data- Returns:
- the result (can be empty, if no convertor was found)
-
convert
public <K,F,T,D extends ConvertorData> Optional<T> convert(Map<K,F> source, D data)
Description copied from interface:ConvertorExecutorLookup and use convertor by specified type, then converts source collection and returns converted result.- Specified by:
convertin interfaceConvertorExecutor- Type Parameters:
K- the source key typeF- the source value typeT- the result typeD- the data type- Parameters:
source- the source collectiondata- convertor data- Returns:
- the result (can be empty, if no convertor was found)
-
convert
public <F,T,D extends ConvertorData> Optional<T> convert(Collection<F> source, D data)
Description copied from interface:ConvertorExecutorLookup and use convertor by specified type, then converts source collection and returns converted result.- Specified by:
convertin interfaceConvertorExecutor- Type Parameters:
F- the source typeT- the result typeD- the data type- Parameters:
source- the source collectiondata- convertor data- Returns:
- the result (can be empty, if no convertor was found)
-
-