Package org.instancio
Interface InstancioFeedApi<F extends Feed>
- Type Parameters:
F- the type of feed
- All Superinterfaces:
FeedApi,SettingsApi
An API for customising the properties of a
Feed.- Since:
- 5.0.0
-
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates an instance of the feed.dataAccess(FeedDataAccess feedDataAccess) Specifies the data access mode for the feed (sequential or random).formatOptions(FormatOptionsProvider provider) Specifies the data format options of aFeed, for example:formatType(FeedFormatType feedFormatType) Specifies the data format type for the feed, such as CSV (by default) or JSON, for example:onDataEnd(FeedDataEndAction feedDataEndAction) Specifies the action to take when the end of the data feed is reached.withDataSource(DataSourceProvider provider) Specifies the data source for aFeed, for example:<V> InstancioFeedApi<F> withSetting(SettingKey<V> key, V value) Overrides the setting for the givenkeywith the specifiedvalue.withSettings(Settings settings) Merges the specifiedSettingswith the current settings, allowing for the addition and update of settings.withTagKey(String tagKey) Specifies the tag key for filtering records in the data feed.withTagValue(String tagValue) Specifies the tag value of the records to fetch.
-
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 aFeed, 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 aFeed, for example:SampleFeed feed = Instancio.ofFeed(SampleFeed.class) .formatOptions(format -> format.csv() .commentPrefix("#") .delimiter('|') .trimValues(true)) .create();- Specified by:
formatOptionsin interfaceFeedApi- Parameters:
provider- of format options- Returns:
- API builder reference
- Since:
- 5.0.0
-
formatType
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:
formatTypein interfaceFeedApi- 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:
withTagKeyin interfaceFeedApi- Parameters:
tagKey- the key used to tag records- Returns:
- API builder reference
- Since:
- 5.0.0
-
withTagValue
Specifies the tag value of the records to fetch.- Specified by:
withTagValuein interfaceFeedApi- Parameters:
tagValue- the value of the tag to filter records by- Returns:
- API builder reference
- Since:
- 5.0.0
-
dataAccess
Specifies the data access mode for the feed (sequential or random).The default is determined by the
Keys.FEED_DATA_ACCESSsetting value.- Specified by:
dataAccessin interfaceFeedApi- Parameters:
feedDataAccess- the data access mode- Returns:
- API builder reference
- Since:
- 5.0.0
-
onDataEnd
Specifies the action to take when the end of the data feed is reached. -
withSetting
Overrides the setting for the givenkeywith the specifiedvalue.- Specified by:
withSettingin interfaceSettingsApi- Type Parameters:
V- the setting value type- Parameters:
key- the setting key to overridevalue- the setting value- Returns:
- API builder reference
- Since:
- 5.0.0
- See Also:
-
withSettings
Merges the specifiedSettingswith 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:
withSettingsin interfaceSettingsApi- Parameters:
settings- the custom settings to merge with the current settings- Returns:
- API builder reference
- Since:
- 5.0.0
- See Also:
-