public static final class FileData.FileSynchronizerBuilder extends java.lang.Object implements DataSourceBuilder<Synchronizer>
Synchronizer that loads and watches file data.
This class is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode
| Modifier and Type | Method and Description |
|---|---|
FileData.FileSynchronizerBuilder |
autoUpdate(boolean autoUpdate)
Specifies whether the data source should watch for changes to the source file(s) and reload flags
whenever there is a change.
|
Synchronizer |
build(DataSourceBuildInputs context)
Builds a data source instance based on the provided context.
|
FileData.FileSynchronizerBuilder |
classpathResources(java.lang.String... resourceLocations)
Adds any number of classpath resources for loading flag data.
|
FileData.FileSynchronizerBuilder |
duplicateKeysHandling(FileData.DuplicateKeysHandling duplicateKeysHandling)
Specifies how to handle keys that are duplicated across files.
|
FileData.FileSynchronizerBuilder |
filePaths(java.nio.file.Path... filePaths)
Adds any number of source files for loading flag data, specifying each file path as a Path.
|
FileData.FileSynchronizerBuilder |
filePaths(java.lang.String... filePaths)
Adds any number of source files for loading flag data, specifying each file path as a string.
|
FileData.FileSynchronizerBuilder |
shouldPersist(boolean shouldPersist)
Configures whether file data should be persisted to persistent stores.
|
public FileData.FileSynchronizerBuilder shouldPersist(boolean shouldPersist)
By default, file data is not persisted (shouldPersist = false).
Set this to true if you want the SDK to persist flag data to persistent stores.
This isn't the recommended configuration but may be useful for testing scenarios.
Example:
FileData fd = FileData.synchronizer()
.filePaths("./testData/flags.json")
.shouldPersist(true);
shouldPersist - true if file data should be persisted to persistent stores, false otherwiseFileSynchronizerBuilder instancepublic FileData.FileSynchronizerBuilder filePaths(java.lang.String... filePaths) throws java.nio.file.InvalidPathException
filePaths - path(s) to the source file(s); may be absolute or relative to the current working directoryjava.nio.file.InvalidPathException - if one of the parameters is not a valid file pathFileDataSourceBuilder.filePaths(String...)public FileData.FileSynchronizerBuilder filePaths(java.nio.file.Path... filePaths)
filePaths - path(s) to the source file(s); may be absolute or relative to the current working directoryFileDataSourceBuilder.filePaths(Path...)public FileData.FileSynchronizerBuilder classpathResources(java.lang.String... resourceLocations)
resourceLocations - resource location(s) in the format used by ClassLoader.getResource()FileDataSourceBuilder.classpathResources(String...)public FileData.FileSynchronizerBuilder autoUpdate(boolean autoUpdate)
autoUpdate - true if flags should be reloaded whenever a source file changesFileDataSourceBuilder.autoUpdate(boolean)public FileData.FileSynchronizerBuilder duplicateKeysHandling(FileData.DuplicateKeysHandling duplicateKeysHandling)
duplicateKeysHandling - specifies how to handle duplicate keysFileDataSourceBuilder#duplicateKeysHandling(DuplicateKeysHandling)public Synchronizer build(DataSourceBuildInputs context)
DataSourceBuilderbuild in interface DataSourceBuilder<Synchronizer>context - the context for building the data source