com.holonplatform.vaadin.data

## Interface ItemDataSource.Builder<ITEM,PROPERTY>

- Type Parameters:
    `PROPERTY` - Item property type
    `ITEM` - Item type
  Enclosing interface:
    ItemDataSource<ITEM,PROPERTY>

      public static interface ItemDataSource.Builder<ITEM,PROPERTY>

  Builder to create `ItemDataSource` instances.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `autoRefresh(boolean autoRefresh)` Set if auto-refresh is enabled for this container, i.e. items are loaded when one of the Container method which involve operations on item set is called.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `batchSize(int batchSize)` Set batch (page) size for items loading using `ItemDataProvider`.
    `ItemDataSource<ITEM,PROPERTY>` | `build()` Build `ItemDataSource` instance
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `commitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)` Set the handler to manage item set modifications.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `dataSource(ItemDataProvider<ITEM> dataProvider)` Set the items data provider.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `defaultSort(com.holonplatform.core.query.QuerySort sort)` Set query default sort.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `defaultValue(PROPERTY propertyId, Object defaultValue)` Set a default value to initialize the given `propertyId`
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `fixedFilter(com.holonplatform.core.query.QueryFilter filter)` Set query fixed filter (always added to query predicates)
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `fixedSort(com.holonplatform.core.query.QuerySort sort)` Set query fixed sort (always added to query sorts)
    `<ID> ItemDataSource.Builder<ITEM,PROPERTY>` | `itemIdentifier(ItemIdentifierProvider<ITEM,ID> itemIdentifierProvider)` Set the item identifier provider to use to obtain item ids.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `maxCacheSize(int maxCacheSize)` Set max items cache size
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `propertyId(PROPERTY property, String propertyId)` Set the property String id of given `property`.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `queryParameter(String name, Object value)` Add a query parameter
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `readOnly(PROPERTY propertyId, boolean readOnly)` Set whether given property id is read-only.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `sortable(boolean sortable)` Set whether all the properties are sortable.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `sortable(PROPERTY propertyId, boolean sortable)` Set whether given property id is sortable.
    `default ItemDataSource.Builder<ITEM,PROPERTY>` | `withProperty(PROPERTY property, Class<?> type)` Add an Item property to this data source.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withProperty(PROPERTY property, Class<?> type, boolean generatePropertyId)` Add an Item property to this data source.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withPropertySortGenerator(PROPERTY property, ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)` Set a `ItemDataSource.PropertySortGenerator` to generate `QuerySort`s for given `property`
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)` Add an external `QueryConfigurationProvider` for additional query configuration
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withReadOnlyProperty(PROPERTY property, Class<?> type)` Add an Item property to this data source and declares it as read-only.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withReadOnlySortableProperty(PROPERTY property, Class<?> type)` Add an Item property to this data source and declares it as read-only and sortable.
    `ItemDataSource.Builder<ITEM,PROPERTY>` | `withSortableProperty(PROPERTY property, Class<?> type)` Add an Item property to this data source and declares it as sortable.

- - ### Method Detail

    - #### dataSource

          ItemDataSource.Builder<ITEM,PROPERTY> dataSource(ItemDataProvider<ITEM> dataProvider)

      Set the items data provider.
      Parameters:
        `dataProvider` - The items data provider to set
      Returns:
        this

    - #### itemIdentifier

          <ID> ItemDataSource.Builder<ITEM,PROPERTY> itemIdentifier(ItemIdentifierProvider<ITEM,ID> itemIdentifierProvider)

      Set the item identifier provider to use to obtain item ids.
      Type Parameters:
        `ID` - Item id type
      Parameters:
        `itemIdentifierProvider` - the item identifier provider to set
      Returns:
        this

    - #### withProperty

          ItemDataSource.Builder<ITEM,PROPERTY> withProperty(PROPERTY property,
                                                             Class<?> type,
                                                             boolean generatePropertyId)

      Add an Item property to this data source.
      Parameters:
        `property` - Property to add (not null)
        `type` - Property value type (not null)
        `generatePropertyId` - Whether to auto generate a property id as String
      Returns:
        this

    - #### withProperty

          default ItemDataSource.Builder<ITEM,PROPERTY> withProperty(PROPERTY property,
                                                                     Class<?> type)

      Add an Item property to this data source.
      Parameters:
        `property` - Property to add (not null)
        `type` - Property value type (not null)
      Returns:
        this

    - #### withSortableProperty

          ItemDataSource.Builder<ITEM,PROPERTY> withSortableProperty(PROPERTY property,
                                                                     Class<?> type)

      Add an Item property to this data source and declares it as sortable.
      Parameters:
        `property` - Property to add (not null)
        `type` - Property value type (not null)
      Returns:
        this

    - #### withReadOnlyProperty

          ItemDataSource.Builder<ITEM,PROPERTY> withReadOnlyProperty(PROPERTY property,
                                                                     Class<?> type)

      Add an Item property to this data source and declares it as read-only.
      Parameters:
        `property` - Property to add (not null)
        `type` - Property value type (not null)
      Returns:
        this

    - #### withReadOnlySortableProperty

          ItemDataSource.Builder<ITEM,PROPERTY> withReadOnlySortableProperty(PROPERTY property,
                                                                             Class<?> type)

      Add an Item property to this data source and declares it as read-only and sortable.
      Parameters:
        `property` - Property to add (not null)
        `type` - Property value type (not null)
      Returns:
        this

    - #### propertyId

          ItemDataSource.Builder<ITEM,PROPERTY> propertyId(PROPERTY property,
                                                           String propertyId)

      Set the property String id of given `property`.
      Parameters:
        `property` - Property (not null)
        `propertyId` - Property id
      Returns:
        this

    - #### autoRefresh

          ItemDataSource.Builder<ITEM,PROPERTY> autoRefresh(boolean autoRefresh)

      Set if auto-refresh is enabled for this container, i.e. items are loaded when one of the Container method which involve operations on item set is called.

      If auto-refresh is not enabled, `ItemDataSource.refresh()` method must be called to load items before using this Container.

      Parameters:
        `autoRefresh` - `true` to enable auto-refresh
      Returns:
        this

    - #### batchSize

          ItemDataSource.Builder<ITEM,PROPERTY> batchSize(int batchSize)

      Set batch (page) size for items loading using `ItemDataProvider`.

      A value `<=0` means no paging, and `ItemDataProvider` should behave in a consistent manner.

      Parameters:
        `batchSize` - Batch (page) size for items loading
      Returns:
        this

    - #### maxCacheSize

          ItemDataSource.Builder<ITEM,PROPERTY> maxCacheSize(int maxCacheSize)

      Set max items cache size
      Parameters:
        `maxCacheSize` - Max cache size to set
      Returns:
        this

    - #### sortable

          ItemDataSource.Builder<ITEM,PROPERTY> sortable(boolean sortable)

      Set whether all the properties are sortable.

      NOTE: It only applies to already added properties.

      Parameters:
        `sortable` - Whether all the properties are sortable
      Returns:
        this

    - #### sortable

          ItemDataSource.Builder<ITEM,PROPERTY> sortable(PROPERTY propertyId,
                                                         boolean sortable)

      Set whether given property id is sortable.
      Parameters:
        `propertyId` - Property id
        `sortable` - Whether given property id is sortable
      Returns:
        this

    - #### readOnly

          ItemDataSource.Builder<ITEM,PROPERTY> readOnly(PROPERTY propertyId,
                                                         boolean readOnly)

      Set whether given property id is read-only.
      Parameters:
        `propertyId` - Property id
        `readOnly` - Whether given property id is read-only
      Returns:
        this

    - #### defaultValue

          ItemDataSource.Builder<ITEM,PROPERTY> defaultValue(PROPERTY propertyId,
                                                             Object defaultValue)

      Set a default value to initialize the given `propertyId`
      Parameters:
        `propertyId` - Property id
        `defaultValue` - Default value
      Returns:
        this

    - #### withPropertySortGenerator

          ItemDataSource.Builder<ITEM,PROPERTY> withPropertySortGenerator(PROPERTY property,
                                                                          ItemDataSource.PropertySortGenerator<PROPERTY> propertySortGenerator)

      Set a `ItemDataSource.PropertySortGenerator` to generate `QuerySort`s for given `property`
      Parameters:
        `property` - Property (not null)
        `propertySortGenerator` - PropertySortGenerator (not null)
      Returns:
        this

    - #### withQueryConfigurationProvider

          ItemDataSource.Builder<ITEM,PROPERTY> withQueryConfigurationProvider(com.holonplatform.core.query.QueryConfigurationProvider queryConfigurationProvider)

      Add an external `QueryConfigurationProvider` for additional query configuration
      Parameters:
        `queryConfigurationProvider` - QueryConfigurationProvider to add
      Returns:
        this

    - #### fixedFilter

          ItemDataSource.Builder<ITEM,PROPERTY> fixedFilter(com.holonplatform.core.query.QueryFilter filter)

      Set query fixed filter (always added to query predicates)
      Parameters:
        `filter` - Query fixed filter, or `null` for none
      Returns:
        this

    - #### fixedSort

          ItemDataSource.Builder<ITEM,PROPERTY> fixedSort(com.holonplatform.core.query.QuerySort sort)

      Set query fixed sort (always added to query sorts)
      Parameters:
        `sort` - Query fixed sort, or `null` for none
      Returns:
        this

    - #### defaultSort

          ItemDataSource.Builder<ITEM,PROPERTY> defaultSort(com.holonplatform.core.query.QuerySort sort)

      Set query default sort. If not `null` and no other sort is available, this one will be used
      Parameters:
        `sort` - Default query sort
      Returns:
        this

    - #### queryParameter

          ItemDataSource.Builder<ITEM,PROPERTY> queryParameter(String name,
                                                               Object value)

      Add a query parameter
      Parameters:
        `name` - Parameter name
        `value` - Parameter value
      Returns:
        this

    - #### commitHandler

          ItemDataSource.Builder<ITEM,PROPERTY> commitHandler(ItemDataSource.CommitHandler<ITEM> commitHandler)

      Set the handler to manage item set modifications.

      This is required to activate item set modification support.

      Parameters:
        `commitHandler` - Item commit handler
      Returns:
        this

    - #### build

          ItemDataSource<ITEM,PROPERTY> build()

      Build `ItemDataSource` instance
      Returns:
        ItemDataSource instance

Copyright © 2019 The Holon Platform. All rights reserved.