Class GsonConfigurationLoader.Builder
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder<GsonConfigurationLoader.Builder,GsonConfigurationLoader>
-
- org.spongepowered.configurate.gson.GsonConfigurationLoader.Builder
-
- Enclosing class:
- GsonConfigurationLoader
public static final class GsonConfigurationLoader.Builder extends AbstractConfigurationLoader.Builder<GsonConfigurationLoader.Builder,GsonConfigurationLoader>
Builds aGsonConfigurationLoader
.This builder supports the following options:
- <prefix>.gson.lenient
- Equivalent to
lenient(boolean)
- <prefix>.gson.indent
- Equivalent to
indent(int)
- 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 @NonNull GsonConfigurationLoader
build()
Builds the loader.int
indent()
Gets the level of indentation to be used by the resultant loader.@NonNull GsonConfigurationLoader.Builder
indent(int indent)
Sets the level of indentation the resultant loader should use.boolean
lenient()
Gets if the resultant loader should parse leniently.@NonNull GsonConfigurationLoader.Builder
lenient(boolean lenient)
Sets if the resultant loader should parse leniently.protected void
populate(LoaderOptionSource options)
Populate options from the provided source.-
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<GsonConfigurationLoader.Builder,GsonConfigurationLoader>
- Parameters:
options
- the options to read
-
indent
public @NonNull GsonConfigurationLoader.Builder indent(int indent)
Sets the level of indentation the resultant loader should use.- Parameters:
indent
- the indent level- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
-
indent
public int indent()
Gets the level of indentation to be used by the resultant loader.- Returns:
- the indent level
- Since:
- 4.0.0
-
lenient
public @NonNull GsonConfigurationLoader.Builder lenient(boolean lenient)
Sets if the resultant loader should parse leniently.- Parameters:
lenient
- whether the parser should parse leniently- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
- See Also:
JsonReader.setLenient(boolean)
-
lenient
public boolean lenient()
Gets if the resultant loader should parse leniently.- Returns:
- whether the parser should parse leniently
- Since:
- 4.0.0
-
build
public @NonNull GsonConfigurationLoader build()
Description copied from class:AbstractConfigurationLoader.Builder
Builds the loader.- Specified by:
build
in classAbstractConfigurationLoader.Builder<GsonConfigurationLoader.Builder,GsonConfigurationLoader>
- Returns:
- a new loader
-
-