Class XmlConfigurationLoader.Builder
- java.lang.Object
-
- org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder<XmlConfigurationLoader.Builder,XmlConfigurationLoader>
-
- org.spongepowered.configurate.xml.XmlConfigurationLoader.Builder
-
- Enclosing class:
- XmlConfigurationLoader
public static final class XmlConfigurationLoader.Builder extends AbstractConfigurationLoader.Builder<XmlConfigurationLoader.Builder,XmlConfigurationLoader>
Builds aXmlConfigurationLoader
.- Since:
- 4.0.0
-
-
Field Summary
-
Fields inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
defaultOptions, headerMode, sink, source
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlConfigurationLoader
build()
Builds the loader.@NonNull String
defaultTagName()
Gets the default tag name to be used by the resultant loader.XmlConfigurationLoader.Builder
defaultTagName(String defaultTagName)
Sets the default tag name the resultant loader should use.boolean
includesXmlDeclaration()
Gets if the resultant loader should include the XML declaration header when saving.XmlConfigurationLoader.Builder
includesXmlDeclaration(boolean includeXmlDeclaration)
Sets if the resultant loader should include the XML declaration header when saving.int
indent()
Gets the level of indentation to be used by the resultant loader.@NonNull XmlConfigurationLoader.Builder
indent(int indent)
Sets the level of indentation the resultant loader should use.boolean
resolvesExternalContent()
Get whether external content should be resolved.XmlConfigurationLoader.Builder
resolvesExternalContent(boolean resolvesExternalContent)
Sets whether external content should be resolved when loading data.@Nullable Schema
schema()
Gets theSchema
to be used by the resultant loader.XmlConfigurationLoader.Builder
schema(@Nullable Schema schema)
Sets theSchema
the resultant loader should use.boolean
writesExplicitType()
Gets if explicit type attributes should be written by the loader.XmlConfigurationLoader.Builder
writesExplicitType(boolean writeExplicitType)
Sets if the resultant loader should write the explicit type of each node when saving nodes.-
Methods inherited from class org.spongepowered.configurate.loader.AbstractConfigurationLoader.Builder
defaultOptions, defaultOptions, defaultOptions, file, headerMode, headerMode, path, sink, sink, source, source, url
-
-
-
-
Method Detail
-
indent
public @NonNull XmlConfigurationLoader.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
-
schema
public XmlConfigurationLoader.Builder schema(@Nullable Schema schema)
Sets theSchema
the resultant loader should use.- Parameters:
schema
- the schema- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
-
schema
public @Nullable Schema schema()
Gets theSchema
to be used by the resultant loader.- Returns:
- the schema
- Since:
- 4.0.0
-
defaultTagName
public XmlConfigurationLoader.Builder defaultTagName(String defaultTagName)
Sets the default tag name the resultant loader should use.- Parameters:
defaultTagName
- the default tag name- Returns:
- this builder (for chaining)
- Since:
- 4.0.0
-
defaultTagName
public @NonNull String defaultTagName()
Gets the default tag name to be used by the resultant loader.- Returns:
- the default tag name
- Since:
- 4.0.0
-
writesExplicitType
public XmlConfigurationLoader.Builder writesExplicitType(boolean writeExplicitType)
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)
- Since:
- 4.0.0
-
writesExplicitType
public boolean writesExplicitType()
Gets if explicit type attributes should be written by the loader.See the method doc at
writesExplicitType(boolean)
for a more detailed explanation.- Returns:
- the default tag name
- Since:
- 4.0.0
-
includesXmlDeclaration
public XmlConfigurationLoader.Builder includesXmlDeclaration(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)
- Since:
- 4.0.0
-
includesXmlDeclaration
public boolean includesXmlDeclaration()
Gets if the resultant loader should include the XML declaration header when saving.- Returns:
- if the XML declaration should be included
- Since:
- 4.0.0
-
resolvesExternalContent
public XmlConfigurationLoader.Builder resolvesExternalContent(boolean resolvesExternalContent)
Sets whether external content should be resolved when loading data.Resolving this content could result in network requests being made, and will allow configuration files to access arbitrary URLs This setting should only be enabled with caution.
Additionally, through use of features such as entity expansion and XInclude, documents can be crafted that will grow exponentially when parsed, requiring an amount of memory to store that may be greater than what is available for the JVM.
By default, this is false.
- Parameters:
resolvesExternalContent
- whether to resolve external entities- Returns:
- this builder
- Since:
- 4.0.0
-
resolvesExternalContent
public boolean resolvesExternalContent()
Get whether external content should be resolved.- Returns:
- value, defaulting to false
- Since:
- 4.0.0
-
build
public XmlConfigurationLoader build()
Description copied from class:AbstractConfigurationLoader.Builder
Builds the loader.- Specified by:
build
in classAbstractConfigurationLoader.Builder<XmlConfigurationLoader.Builder,XmlConfigurationLoader>
- Returns:
- a new loader
-
-