Class CountDataSource

  • All Implemented Interfaces:
    AggregateDataSource, DataSource

    public class CountDataSource
    extends Object
    implements AggregateDataSource
    AggregateDataSource that returns the count of a particular type of object. Given that data sources operate on specific object types, this can just return the size argument.
    Author:
    Nick Collier
    • Constructor Detail

      • CountDataSource

        public CountDataSource​(String id,
                               Class<?> sourceType)
        Parameters:
        id -
    • Method Detail

      • getId

        public String getId()
        Description copied from interface: DataSource
        Gets the unique id of this DataSource. The id should be unique across the DataSet that this source is added to.
        Specified by:
        getId in interface DataSource
        Returns:
        the unique id of this DataSource.
      • getDataType

        public Class<Integer> getDataType()
        Description copied from interface: DataSource
        Gets the type of data produced by this DataSource.
        Specified by:
        getDataType in interface DataSource
        Returns:
        the type of data produced by this DataSource.
      • get

        public Integer get​(Iterable<?> objs,
                           int size)
        Description copied from interface: AggregateDataSource
        Gets the data using the specified iterable.
        Specified by:
        get in interface AggregateDataSource
        Parameters:
        objs - the iterable over objects to use in getting the data
        size - the number of objects in the iterable
        Returns:
        the data using the specified iterable.
      • getSourceType

        public Class<?> getSourceType()
        Description copied from interface: DataSource
        Gets the type of the object that this DataSource can retreive data from.
        Specified by:
        getSourceType in interface DataSource
        Returns:
        the type of the object that this DataSource can retreive data from.