com.holonplatform.core.datastore

## Interface DatastoreCommodityHandler

- All Known Subinterfaces:
    AsyncDatastore, BeanDatastore, ConfigurableDatastore, Datastore

      public interface DatastoreCommodityHandler

  Represents a `DatastoreCommodity` handler, which provides available commodities and allow to create `DatastoreCommodity` instances.
  Since:
    5.1.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `<C extends DatastoreCommodity> C` | `create(Class<C> commodityType)` Create a new `DatastoreCommodity` of given `commodityType` type.
    `Collection<Class<? extends DatastoreCommodity>>` | `getAvailableCommodities()` Get the available `DatastoreCommodity` types.
    `default boolean` | `hasCommodity(Class<? extends DatastoreCommodity> commodityType)` Get whether given `DatastoreCommodity` type is available.

- - ### Method Detail

    - #### getAvailableCommodities

          Collection<Class<? extends DatastoreCommodity>> getAvailableCommodities()

      Get the available `DatastoreCommodity` types. A registered `DatastoreCommodity` can be created using the `create(Class)` method.
      Returns:
        Available `DatastoreCommodity` types collection, empty if none

    - #### hasCommodity

          default boolean hasCommodity(Class<? extends DatastoreCommodity> commodityType)

      Get whether given `DatastoreCommodity` type is available.
      Parameters:
        `commodityType` - The commodity type to check (not null)
      Returns:
        `true` if given commodity type is available, `false` otherwise

    - #### create

          <C extends DatastoreCommodity> C create(Class<C> commodityType)

      Create a new `DatastoreCommodity` of given `commodityType` type.

      Available commodity types can be obtained using `getAvailableCommodities()`.

      Type Parameters:
        `C` - Commodity type
      Parameters:
        `commodityType` - The commodity type to create (not null)
      Returns:
        The commodity instance
      Throws:
        `DatastoreCommodityContext.CommodityNotAvailableException` - If a commodity of the required type is not available
        `DatastoreCommodityContext.CommodityConfigurationException` - If a commodity configuration error occurred

Copyright © 2019 The Holon Platform. All rights reserved.