Class DataProviderImpl

  • All Implemented Interfaces:
    DataProvider

    @Component
    public class DataProviderImpl
    extends java.lang.Object
    implements DataProvider
    Default implementation of DataProvider. The class uses a three step process to determine the data source:
    1. Asks the ListableBeanFactory for data sources which provide the given dataType.
    2. For each candidate it calls DataSource.getSelectorType() and ensures the returned class to be compatible with the given selector.
    3. Calls DataSource.canHandle(Object) for each data source candidate and filters all candidates which return true.
    If an only if there is exactly one data source remaining, the DataSource.getData(Object) method of this data source is invoked and returned.
    Since:
    3.0.0
    Author:
    Oliver Libutzki <[email protected]>
    • 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 an Iterable of the given data type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataProviderImpl

        public DataProviderImpl()
    • Method Detail

      • getData

        public <SelectorType,​DataType> java.lang.Iterable<DataType> getData​(java.lang.Class<DataType> dataType,
                                                                                  SelectorType selector)
        Description copied from interface: DataProvider
        Provides an Iterable 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 interface DataProvider
        Parameters:
        dataType - Type of the requested data
        selector - the selector which is used to determine the data to be provided
        Returns:
        An Iterable of the requested data type