Class YamlMurmel.Builder

java.lang.Object
de.murmelmeister.library.configuration.YamlMurmel.Builder
Enclosing class:
YamlMurmel

public static final class YamlMurmel.Builder extends Object
A Builder class for constructing instances of YamlMurmel with customizable options. This class allows setting various parameters such as indentation, flow style, width, comment processing, duplicate key handling, and more.
  • Field Details

    • fileName

      private final String fileName
    • indent

      private int indent
    • prettyFlow

      private boolean prettyFlow
    • width

      private int width
    • processComments

      private boolean processComments
    • allowDuplicateKeys

      private boolean allowDuplicateKeys
    • maxAliasesForCollections

      private int maxAliasesForCollections
    • wrappedToRootException

      private boolean wrappedToRootException
  • Constructor Details

    • Builder

      private Builder(String fileName)
      Constructs a new Builder instance with the specified file name.
      Parameters:
      fileName - The name of the file to be associated with this Builder
  • Method Details

    • indent

      public YamlMurmel.Builder indent(int indent)
      Sets the indent size to be used and returns the Builder instance.
      Parameters:
      indent - The number of spaces to use for indentation.
      Returns:
      The Builder instance with the updated indent setting.
    • prettyFlow

      public YamlMurmel.Builder prettyFlow(boolean prettyFlow)
      Configures whether the flow presentation should be formatted in a "pretty" style.
      Parameters:
      prettyFlow - A boolean indicating whether to enable or disable pretty flow formatting.
      Returns:
      The Builder instance with the updated pretty flow setting.
    • width

      public YamlMurmel.Builder width(int width)
      Sets the maximum width for formatting and returns the Builder instance.
      Parameters:
      width - The maximum width to be used for formatting.
      Returns:
      The Builder instance with the updated width setting.
    • processComments

      public YamlMurmel.Builder processComments(boolean processComments)
      Configures whether comments should be processed and included during the building process.
      Parameters:
      processComments - A boolean indicating whether to enable or disable processing of comments.
      Returns:
      The Builder instance with the updated process comments setting.
    • allowDuplicateKeys

      public YamlMurmel.Builder allowDuplicateKeys(boolean allowDuplicateKeys)
      Configures whether duplicate keys are allowed in the data structure being processed.
      Parameters:
      allowDuplicateKeys - A boolean indicating whether to allow or disallow duplicate keys.
      Returns:
      The Builder instance with the updated allows duplicate keys setting.
    • maxAliasesForCollections

      public YamlMurmel.Builder maxAliasesForCollections(int maxAliasesForCollections)
      Sets the maximum allowed aliases for collections and returns the Builder instance.
      Parameters:
      maxAliasesForCollections - The maximum number of aliases permitted for collections.
      Returns:
      The Builder instance with the updated maximum aliases for collection setting.
    • wrappedToRootException

      public YamlMurmel.Builder wrappedToRootException(boolean wrappedToRootException)
      Configures whether exceptions should be wrapped to root exceptions during processing.
      Parameters:
      wrappedToRootException - A boolean indicating whether to enable or disable wrapping to root exceptions.
      Returns:
      The Builder instance with the updated wrapped to root exception setting.
    • build

      public YamlMurmel build()
      Builds and returns a new instance of YamlMurmel configured with the current state of the Builder instance.
      Returns:
      A new YamlMurmel instance configured with the settings defined in the builder.