Package ninja.leaping.configurate.xml
Class XMLConfigurationLoader.Builder
java.lang.Object
ninja.leaping.configurate.loader.AbstractConfigurationLoader.Builder<XMLConfigurationLoader.Builder>
ninja.leaping.configurate.xml.XMLConfigurationLoader.Builder
- Enclosing class:
- XMLConfigurationLoader
public static class XMLConfigurationLoader.Builder extends AbstractConfigurationLoader.Builder<XMLConfigurationLoader.Builder>
Builds a
XMLConfigurationLoader
.-
Field Summary
Fields inherited from class ninja.leaping.configurate.loader.AbstractConfigurationLoader.Builder
defaultOptions, headerMode, sink, source
-
Constructor Summary
Constructors Modifier Constructor Description protected
Builder()
-
Method Summary
Modifier and Type Method Description @NonNull XMLConfigurationLoader
build()
Builds the loader.@NonNull String
getDefaultTagName()
Gets the default tag name to be used by the resultant loader.int
getIndent()
Gets the level of indentation to be used by the resultant loader.@Nullable Schema
getSchema()
Gets theSchema
to be used by the resultant loader.@NonNull XMLConfigurationLoader.Builder
setDefaultTagName(@NonNull String defaultTagName)
Sets the default tag name the resultant loader should use.@NonNull XMLConfigurationLoader.Builder
setIncludeXmlDeclaration(boolean includeXmlDeclaration)
Sets if the resultant loader should include the XML declaration header when saving.@NonNull XMLConfigurationLoader.Builder
setIndent(int indent)
Sets the level of indentation the resultant loader should use.@NonNull XMLConfigurationLoader.Builder
setSchema(@Nullable Schema schema)
Sets theSchema
the resultant loader should use.@NonNull XMLConfigurationLoader.Builder
setWriteExplicitType(boolean writeExplicitType)
Sets if the resultant loader should write the explicit type of each node when saving nodes.boolean
shouldIncludeXmlDeclaration()
Gets if the resultant loader should include the XML declaration header when saving.boolean
shouldWriteExplicitType()
Gets if explicit type attributes should be written by the resultant loader.Methods inherited from class ninja.leaping.configurate.loader.AbstractConfigurationLoader.Builder
getDefaultOptions, getHeaderMode, getSink, getSource, preservesHeader, setDefaultOptions, setDefaultOptions, setFile, setHeaderMode, setPath, setPreservesHeader, setSink, setSource, setURL
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
setIndent
Sets the level of indentation the resultant loader should use.- Parameters:
indent
- The indent level- Returns:
- This builder (for chaining)
-
getIndent
Gets the level of indentation to be used by the resultant loader.- Returns:
- The indent level
-
setSchema
Sets theSchema
the resultant loader should use.- Parameters:
schema
- The schema- Returns:
- This builder (for chaining)
-
getSchema
Gets theSchema
to be used by the resultant loader.- Returns:
- The schema
-
setDefaultTagName
Sets the default tag name the resultant loader should use.- Parameters:
defaultTagName
- The default tag name- Returns:
- This builder (for chaining)
-
getDefaultTagName
Gets the default tag name to be used by the resultant loader.- Returns:
- The default tag name
-
setWriteExplicitType
Sets if the resultant loader should write the explicit type of each node when saving nodes.This is necessary in some cases, as XML has no explicit definition of an array or list. The loader is able to infer the type in some cases, but this is inaccurate in some cases, for example lists with only one element.
- Parameters:
writeExplicitType
- If the loader should write explicit types- Returns:
- This builder (for chaining)
-
shouldWriteExplicitType
Gets if explicit type attributes should be written by the resultant loader.See the method doc for
setWriteExplicitType(boolean)
for a more detailed explanation.- Returns:
- The default tag name
-
setIncludeXmlDeclaration
public @NonNull XMLConfigurationLoader.Builder setIncludeXmlDeclaration(boolean includeXmlDeclaration)Sets if the resultant loader should include the XML declaration header when saving.- Parameters:
includeXmlDeclaration
- If the XML declaration should be included- Returns:
- This builder (for chaining)
-
shouldIncludeXmlDeclaration
Gets if the resultant loader should include the XML declaration header when saving.- Returns:
- If the XML declaration should be included
-
build
Description copied from class:AbstractConfigurationLoader.Builder
Builds the loader.- Specified by:
build
in classAbstractConfigurationLoader.Builder<XMLConfigurationLoader.Builder>
- Returns:
- The loader
-