Package de.bmiag.tapir.datasource.api
Class DataProviderImpl
- java.lang.Object
-
- de.bmiag.tapir.datasource.api.DataProviderImpl
-
- All Implemented Interfaces:
DataProvider
@Component public class DataProviderImpl extends java.lang.Object implements DataProvider
Default implementation ofDataProvider
. The class uses a three step process to determine the data source:- Asks the
ListableBeanFactory
fordata sources
which provide the given dataType. - For each candidate it calls
DataSource.getSelectorType()
and ensures the returned class to be compatible with the given selector. - Calls
DataSource.canHandle(Object)
for each data source candidate and filters all candidates which return true.
DataSource.getData(Object)
method of this data source is invoked and returned.- Since:
- 3.0.0
- Author:
- Oliver Libutzki <[email protected]>
-
-
Constructor Summary
Constructors Constructor Description DataProviderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <SelectorType,DataType>
java.lang.Iterable<DataType>getData(java.lang.Class<DataType> dataType, SelectorType selector)
Provides anIterable
of the given data type.
-
-
-
Method Detail
-
getData
public <SelectorType,DataType> java.lang.Iterable<DataType> getData(java.lang.Class<DataType> dataType, SelectorType selector)
Description copied from interface:DataProvider
Provides anIterable
of the given data type. Based on the requested type and the given selector the method tries to find exactly one data source which is able to handle the request. If it succeeds,DataSource.getData(Object)
is called an returned.- Specified by:
getData
in interfaceDataProvider
- Parameters:
dataType
- Type of the requested dataselector
- the selector which is used to determine the data to be provided- Returns:
- An
Iterable
of the requested data type
-
-