Class HoconConfigurationLoader.Builder
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder<HoconConfigurationLoader.Builder,HoconConfigurationLoader>
-
- org.spongepowered.configurate.hocon.HoconConfigurationLoader.Builder
-
- Enclosing class:
- HoconConfigurationLoader
public static final class HoconConfigurationLoader.Builder extends AbstractConfigurationLoader.Builder<HoconConfigurationLoader.Builder,HoconConfigurationLoader>
Builds aHoconConfigurationLoader
.This builder supports the following options:
- <prefix>.hocon.pretty-printing
- Equivalent to
prettyPrinting(boolean)
- <prefix>.hocon.indent
- Equivalent to
indent(int)
- <prefix>.hocon.emit-comments
- Equivalent to
emitComments(boolean)
- <prefix>.hocon.json-compatible
- Equivalent to
emitJsonCompatible(boolean)
- Since:
- 4.0.0
-
-
Field Summary
-
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
DEFAULT_OPTIONS_SOURCE, defaultOptions, headerMode, sink, source
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HoconConfigurationLoader
build()
Builds the loader.HoconConfigurationLoader.Builder
emitComments(boolean emitComments)
Set whether comments should be emitted.HoconConfigurationLoader.Builder
emitJsonCompatible(boolean jsonCompatible)
Set whether output generated by this loader should be json-compatible.HoconConfigurationLoader.Builder
indent(int indent)
Set the amount of spaces to indent with whenprettyPrinting(boolean)
is on.protected void
populate(LoaderOptionSource options)
Populate options from the provided source.HoconConfigurationLoader.Builder
prettyPrinting(boolean prettyPrinting)
Set whether output from this loader will be pretty-printed or not.-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
buildAndLoadString, buildAndSaveString, defaultOptions, defaultOptions, defaultOptions, file, from, headerMode, headerMode, path, sink, sink, source, source, url
-
-
-
-
Method Detail
-
populate
protected void populate(LoaderOptionSource options)
Description copied from class:AbstractConfigurationLoader.Builder
Populate options from the provided source.The source will have already been validated for nullness.
- Overrides:
populate
in classAbstractConfigurationLoader.Builder<HoconConfigurationLoader.Builder,HoconConfigurationLoader>
- Parameters:
options
- the options to read
-
prettyPrinting
public HoconConfigurationLoader.Builder prettyPrinting(boolean prettyPrinting)
Set whether output from this loader will be pretty-printed or not.- Parameters:
prettyPrinting
- whether to pretty-print- Returns:
- this builder
- Since:
- 4.0.0
-
indent
public HoconConfigurationLoader.Builder indent(int indent)
Set the amount of spaces to indent with whenprettyPrinting(boolean)
is on.Defaults to 4.
- Parameters:
indent
- indent level- Returns:
- this builder
- Since:
- 4.2.0
-
emitComments
public HoconConfigurationLoader.Builder emitComments(boolean emitComments)
Set whether comments should be emitted.Comments will always be loaded from files and stored in memory.
- Parameters:
emitComments
- whether to emit comments- Returns:
- this builder
- Since:
- 4.0.0
-
emitJsonCompatible
public HoconConfigurationLoader.Builder emitJsonCompatible(boolean jsonCompatible)
Set whether output generated by this loader should be json-compatible.Whatever format input is received in, this will output JSON. To be fully spec-compliant, comment output must also be disabled.
- Parameters:
jsonCompatible
- to emit json-format output- Returns:
- this builder
- Since:
- 4.0.0
-
build
public HoconConfigurationLoader build()
Description copied from class:AbstractConfigurationLoader.Builder
Builds the loader.- Specified by:
build
in classAbstractConfigurationLoader.Builder<HoconConfigurationLoader.Builder,HoconConfigurationLoader>
- Returns:
- a new loader
-
-