Module tcconfig.core
Class AbstractFileConfigBuilder<T extends FileConfig>
- java.lang.Object
-
- xyz.tozymc.configuration.builder.AbstractConfigBuilder<T>
-
- xyz.tozymc.configuration.file.builder.AbstractFileConfigBuilder<T>
-
- Type Parameters:
T- The type of file configuration.
public abstract class AbstractFileConfigBuilder<T extends FileConfig> extends AbstractConfigBuilder<T>
Builder class to create a new file configuration.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFileConfigBuilder(Path configPath)Constructs new file configuration builder with configPath.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TbuildConfig()@NotNull PathconfigPath()Gets the configuration file.TcreateConfig()Creates new configuration with specified parameters.@NotNull AbstractFileConfigBuilder<T>defaultResource(@NotNull ClassLoader classLoader, @NotNull String name)Sets the default config input stream by class resource.@Nullable InputStreamdefaultStream()Gets the default config input stream.@NotNull AbstractFileConfigBuilder<T>defaultStream(@NotNull InputStream defaultStream)Sets the default config input stream.@NotNull ReloadableTypereloadType()Gets the configuration reload type, default isReloadableType.MANUALLY.@NotNull AbstractFileConfigBuilder<T>reloadType(@NotNull ReloadableType reloadableType)Sets the configuration reload type.-
Methods inherited from class xyz.tozymc.configuration.builder.AbstractConfigBuilder
pathSeparator, pathSeparator
-
-
-
-
Method Detail
-
configPath
@NotNull public @NotNull Path configPath()
Gets the configuration file.- Returns:
- The configuration file.
-
defaultStream
@Nullable public @Nullable InputStream defaultStream()
Gets the default config input stream.If
configPathis not existed, the builder will create new file with the data received in this stream.- Returns:
- The default config input stream.
-
defaultStream
@NotNull public @NotNull AbstractFileConfigBuilder<T> defaultStream(@NotNull @NotNull InputStream defaultStream)
Sets the default config input stream.If
configPathis not existed, the builder will create new file with the data received in this stream.- Parameters:
defaultStream- The input stream.- Returns:
- This builder, for chaining.
-
defaultResource
@NotNull public @NotNull AbstractFileConfigBuilder<T> defaultResource(@NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull String name)
Sets the default config input stream by class resource.If
configPathis not existed, the builder will create new file with the data received in this stream.- Parameters:
classLoader- The class loader contain the resource.name- The resource name.- Returns:
- This builder, for chaining.
-
reloadType
@NotNull public @NotNull ReloadableType reloadType()
Gets the configuration reload type, default isReloadableType.MANUALLY.- Returns:
- Configuration reload type.
-
reloadType
@NotNull public @NotNull AbstractFileConfigBuilder<T> reloadType(@NotNull @NotNull ReloadableType reloadableType)
Sets the configuration reload type.- Parameters:
reloadableType- Reloadable type- Returns:
- This builder, for chaining.
-
createConfig
public T createConfig()
Description copied from class:AbstractConfigBuilderCreates new configuration with specified parameters.- Specified by:
createConfigin classAbstractConfigBuilder<T extends FileConfig>- Returns:
- The new configuration.
-
buildConfig
protected abstract T buildConfig()
-
-