/** * Sets the sink and source of the resultant loader to the given path. * * <p>The {@link #getSource() source} is defined using * {@link Files#newBufferedReader(Path)} with UTF-8 encoding.</p> * * <p>The {@link #getSink() sink} is defined using {@link AtomicFiles} with UTF-8 * encoding.</p> * * @param path The path of the configuration file * @return This builder (for chaining) */ @NonNull public T setPath(@NonNull Path path) { Path absPath = Objects.requireNonNull(path, "path").toAbsolutePath(); this.source = () -> Files.newBufferedReader(absPath, UTF_8); this.sink = AtomicFiles.createAtomicWriterFactory(absPath, UTF_8); return self(); }
/** * Sets the sink and source of the resultant loader to the given file. * * <p>The {@link #getSource() source} is defined using * {@link Files#newBufferedReader(Path)} with UTF-8 encoding.</p> * * <p>The {@link #getSink() sink} is defined using {@link AtomicFiles} with UTF-8 * encoding.</p> * * @param file The configuration file * @return This builder (for chaining) */ @NonNull public T setFile(@NonNull File file) { return setPath(Objects.requireNonNull(file, "file").toPath()); }
/** * Sets the sink and source of the resultant loader to the given path. * * <p>The {@link #getSource() source} is defined using * {@link Files#newBufferedReader(Path)} with UTF-8 encoding.</p> * * <p>The {@link #getSink() sink} is defined using {@link AtomicFiles} with UTF-8 * encoding.</p> * * @param path The path of the configuration file * @return This builder (for chaining) */ @NonNull public T setPath(@NonNull Path path) { Path absPath = Objects.requireNonNull(path, "path").toAbsolutePath(); this.source = () -> Files.newBufferedReader(absPath, UTF_8); this.sink = AtomicFiles.createAtomicWriterFactory(absPath, UTF_8); return self(); }
/** * Sets the sink and source of the resultant loader to the given file. * * <p>The {@link #getSource() source} is defined using * {@link Files#newBufferedReader(Path)} with UTF-8 encoding.</p> * * <p>The {@link #getSink() sink} is defined using {@link AtomicFiles} with UTF-8 * encoding.</p> * * @param file The configuration file * @return This builder (for chaining) */ @NonNull public T setFile(@NonNull File file) { return setPath(Objects.requireNonNull(file, "file").toPath()); }
/** * Sets if the header of the configuration should be preserved. * * <p>See {@link HeaderMode#PRESERVE} and {@link HeaderMode#PRESET}.</p> * * @param preservesHeader If the header should be preserved * @return this builder (for chaining) * @deprecated In favour of {@link #setHeaderMode(HeaderMode)} */ @NonNull @Deprecated public T setPreservesHeader(boolean preservesHeader) { this.headerMode = preservesHeader ? HeaderMode.PRESERVE : HeaderMode.PRESET; return self(); }
/** * Sets if the header of the configuration should be preserved. * * <p>See {@link HeaderMode#PRESERVE} and {@link HeaderMode#PRESET}.</p> * * @param preservesHeader If the header should be preserved * @return this builder (for chaining) * @deprecated In favour of {@link #setHeaderMode(HeaderMode)} */ @NonNull @Deprecated public T setPreservesHeader(boolean preservesHeader) { this.headerMode = preservesHeader ? HeaderMode.PRESERVE : HeaderMode.PRESET; return self(); }
public T setFile(File file) { return setPath(file.toPath()); }
/** * Sets the sink of the resultant loader. * * <p>The "sink" is used by the loader to save the configuration.</p> * * @param sink The sink * @return This builder (for chaining) */ @NonNull public T setSink(@Nullable Callable<BufferedWriter> sink) { this.sink = sink; return self(); }
public T setSource(Callable<BufferedReader> source) { this.source = source; return self(); }
public T setHeaderMode(HeaderMode mode) { this.headerMode = mode; return self(); }
public T setURL(URL url) { this.source = () -> new BufferedReader(new InputStreamReader(url.openConnection().getInputStream(), UTF_8)); return self(); }
/** * Sets the source of the resultant loader. * * <p>The "source" is used by the loader to load the configuration.</p> * * @param source The source * @return This builder (for chaining) */ @NonNull public T setSource(@Nullable Callable<BufferedReader> source) { this.source = source; return self(); }
/** * Sets the source of the resultant loader. * * <p>The "source" is used by the loader to load the configuration.</p> * * @param source The source * @return This builder (for chaining) */ @NonNull public T setSource(@Nullable Callable<BufferedReader> source) { this.source = source; return self(); }
/** * Sets the header mode of the resultant loader. * * @param mode The header mode * @return This builder (for chaining) */ @NonNull public T setHeaderMode(@NonNull HeaderMode mode) { this.headerMode = Objects.requireNonNull(mode, "mode"); return self(); }
public T setSink(Callable<BufferedWriter> sink) { this.sink = sink; return self(); }
public T setPath(Path path) { Path absPath = Objects.requireNonNull(path, "path").toAbsolutePath(); this.source = () -> Files.newBufferedReader(absPath, UTF_8); this.sink = AtomicFiles.createAtomicWriterFactory(absPath, UTF_8); return self(); }
/** * Sets the header mode of the resultant loader. * * @param mode The header mode * @return This builder (for chaining) */ @NonNull public T setHeaderMode(@NonNull HeaderMode mode) { this.headerMode = Objects.requireNonNull(mode, "mode"); return self(); }
public T setDefaultOptions(ConfigurationOptions defaultOptions) { this.defaultOptions = Objects.requireNonNull(defaultOptions, "defaultOptions"); return self(); }
/** * Sets the sink of the resultant loader. * * <p>The "sink" is used by the loader to save the configuration.</p> * * @param sink The sink * @return This builder (for chaining) */ @NonNull public T setSink(@Nullable Callable<BufferedWriter> sink) { this.sink = sink; return self(); }
@Deprecated public T setPreservesHeader(boolean preservesHeader) { this.headerMode = preservesHeader ? HeaderMode.PRESERVE : HeaderMode.PRESET; return self(); }