Package org.instancio

Interface InstancioFeedApi<F extends Feed>

Type Parameters:
F - the type of feed
All Superinterfaces:
FeedApi, SettingsApi

@ExperimentalApi public interface InstancioFeedApi<F extends Feed> extends FeedApi, SettingsApi
An API for customising the properties of a Feed.
Since:
5.0.0
  • Method Details

    • create

      Creates an instance of the feed.
      Returns:
      an instance of the feed
      Since:
      5.0.0
    • withDataSource

      Specifies the data source for a Feed, for example:
      
       SampleFeed feed = Instancio.ofFeed(SampleFeed.class)
           .withDataSource(source -> source.ofResource("data/sample.csv"))
           .create();
       
      Parameters:
      provider - of the data source
      Returns:
      API builder reference
      Since:
      5.0.0
      See Also:
    • formatOptions

      Specifies the data format options of a Feed, for example:
      
       SampleFeed feed = Instancio.ofFeed(SampleFeed.class)
           .formatOptions(format -> format.csv()
               .commentPrefix("#")
               .delimiter('|')
               .trimValues(true))
           .create();
       
      Specified by:
      formatOptions in interface FeedApi
      Parameters:
      provider - of format options
      Returns:
      API builder reference
      Since:
      5.0.0
    • formatType

      @ExperimentalApi InstancioFeedApi<F> formatType(FeedFormatType feedFormatType)
      Specifies the data format type for the feed, such as CSV (by default) or JSON, for example:
      
       SampleFeed feed = Instancio.ofFeed(SampleFeed.class)
           .formatType(FeedFormatType.JSON)
           .create();
       
      Specified by:
      formatType in interface FeedApi
      Parameters:
      feedFormatType - the data format type
      Returns:
      API builder reference
      Since:
      5.0.0
    • withTagKey

      Specifies the tag key for filtering records in the data feed.
      Specified by:
      withTagKey in interface FeedApi
      Parameters:
      tagKey - the key used to tag records
      Returns:
      API builder reference
      Since:
      5.0.0
    • withTagValue

      @ExperimentalApi InstancioFeedApi<F> withTagValue(String tagValue)
      Specifies the tag value of the records to fetch.
      Specified by:
      withTagValue in interface FeedApi
      Parameters:
      tagValue - the value of the tag to filter records by
      Returns:
      API builder reference
      Since:
      5.0.0
    • dataAccess

      InstancioFeedApi<F> dataAccess(FeedDataAccess feedDataAccess)
      Specifies the data access mode for the feed (sequential or random).

      The default is determined by the Keys.FEED_DATA_ACCESS setting value.

      Specified by:
      dataAccess in interface FeedApi
      Parameters:
      feedDataAccess - the data access mode
      Returns:
      API builder reference
      Since:
      5.0.0
    • onDataEnd

      InstancioFeedApi<F> onDataEnd(FeedDataEndAction feedDataEndAction)
      Specifies the action to take when the end of the data feed is reached.
      Specified by:
      onDataEnd in interface FeedApi
      Parameters:
      feedDataEndAction - the strategy for handling end-of-data
      Returns:
      API builder reference
      Since:
      5.0.0
    • withSetting

      @ExperimentalApi <V> InstancioFeedApi<F> withSetting(SettingKey<V> key, V value)
      Overrides the setting for the given key with the specified value.
      Specified by:
      withSetting in interface SettingsApi
      Type Parameters:
      V - the setting value type
      Parameters:
      key - the setting key to override
      value - the setting value
      Returns:
      API builder reference
      Since:
      5.0.0
      See Also:
    • withSettings

      @ExperimentalApi InstancioFeedApi<F> withSettings(Settings settings)
      Merges the specified Settings with the current settings, allowing for the addition and update of settings.

      Use this method to apply custom settings to override the default ones. The provided settings will be combined with the existing settings, updating any overlapping values and adding any new ones.

      Specified by:
      withSettings in interface SettingsApi
      Parameters:
      settings - the custom settings to merge with the current settings
      Returns:
      API builder reference
      Since:
      5.0.0
      See Also: