Class GenericBuilder<Base extends Config,​Result extends FileConfig>

    • Field Detail

      • file

        protected final java.nio.file.Path file
      • charset

        protected java.nio.charset.Charset charset
      • sync

        protected boolean sync
      • autosave

        protected boolean autosave
      • autoreload

        protected boolean autoreload
      • concurrent

        protected boolean concurrent
      • insertionOrder

        protected boolean insertionOrder
      • mapCreator

        protected java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> mapCreator
    • Method Detail

      • defaultResource

        public GenericBuilder<Base,​Result> defaultResource​(java.lang.String resourcePath)
        Sets the resource (in the jar) to copy when the config's file is not found. This is a shortcut for onFileNotFound(FileNotFoundAction.copyResource(resourcePath))
        Parameters:
        resourcePath - the resource's path
        Returns:
        this builder
      • defaultData

        public GenericBuilder<Base,​Result> defaultData​(java.io.File file)
        Sets the file to copy when the config's file is not found. This is a shortcut for onFileNotFound(FileNotFoundAction.copyData(file))
        Parameters:
        file - the data file
        Returns:
        this builder
      • defaultData

        public GenericBuilder<Base,​Result> defaultData​(java.nio.file.Path file)
        Sets the file to copy when the config's file is not found. This is a shortcut for onFileNotFound(FileNotFoundAction.copyData(file))
        Parameters:
        file - the data file
        Returns:
        this builder
      • defaultData

        public GenericBuilder<Base,​Result> defaultData​(java.net.URL url)
        Sets the URL of the data to copy when the config's file is not found. This is a shortcut for onFileNotFound(FileNotFoundAction.copyData(url))
        Parameters:
        url - the data url
        Returns:
        this builder
      • autoreload

        public GenericBuilder<Base,​Result> autoreload()
        Makes the configuration "autoreloaded", that is, its FileConfig.load() method is automatically called when the file is modified.
        Returns:
        this builder
      • concurrent

        public GenericBuilder<Base,​Result> concurrent()
        Makes the configuration concurrent, that is, thread-safe.
        Returns:
        this builder
      • preserveInsertionOrder

        public GenericBuilder<Base,​Result> preserveInsertionOrder()
        Makes the configuration preserve the insertion order of its values.
        Returns:
        this builder
      • backingMapCreator

        public GenericBuilder<Base,​Result> backingMapCreator​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> s)
        Uses a specific Supplier to create the backing maps (one for the top level and one for each sub-configuration) of the configuration.


        Warning : if autoreload() is called, the map creator must return thread-safe maps, because the autoreloading system will modify the configuration from another thread.

        Parameters:
        s - the map supplier to use
        Returns:
        this builder
      • build

        public Result build()
        Creates a new FileConfig with the chosen settings.
        Returns:
        the config
      • getConfig

        protected final Base getConfig()