Class ConvertedFileConfig

    • Constructor Detail

      • ConvertedFileConfig

        public ConvertedFileConfig​(FileConfig config,
                                   java.util.function.Function<java.lang.Object,​java.lang.Object> readConversion,
                                   java.util.function.Function<java.lang.Object,​java.lang.Object> writeConversion,
                                   java.util.function.Predicate<java.lang.Class<?>> supportPredicate)
    • Method Detail

      • getFile

        public java.io.File getFile()
        Specified by:
        getFile in interface FileConfig
        Returns:
        the config's file, as a classic File object
      • getNioPath

        public java.nio.file.Path getNioPath()
        Specified by:
        getNioPath in interface FileConfig
        Returns:
        the config's file, as a NIO Path object
      • save

        public void save()
        Description copied from interface: FileConfig
        Saves this config as soon as possible. This method may return quickly and perform the IO operations in background, or it may block until the operations are done.
        Specified by:
        save in interface FileConfig
      • load

        public void load()
        Description copied from interface: FileConfig
        (Re)loads this config from the file. This method blocks until the read operation completes.
        Specified by:
        load in interface FileConfig
      • close

        public void close()
        Description copied from interface: FileConfig
        Closes this FileConfig, releases its associated resources (if any), and ensure that the ongoing saving operations complete.

        A closed FileConfig can still be used via the Config's methods, but FileConfig.save() and FileConfig.load() will throw an IllegalStateException. Closing an aleady closed FileConfig has no effect.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface FileConfig
      • set

        public <T> T set​(java.util.List<java.lang.String> path,
                         java.lang.Object value)
        Description copied from interface: Config
        Sets a config value.
        Specified by:
        set in interface Config
        Overrides:
        set in class ConfigWrapper<C extends Config>
        Type Parameters:
        T - the type of the old value
        Parameters:
        path - the value's path, each element of the list is a different part of the path.
        value - the value to set
        Returns:
        the old value if any, or null
      • getRaw

        public <T> T getRaw​(java.util.List<java.lang.String> path)
        Description copied from interface: UnmodifiableConfig
        Gets a value from the config. Doesn't convert NullObject.NULL_OBJECT to null.
        Specified by:
        getRaw in interface UnmodifiableConfig
        Overrides:
        getRaw in class UnmodifiableConfigWrapper<C extends Config>
        Type Parameters:
        T - the value's type
        Parameters:
        path - the value's path, each element of the list is a different part of the path.
        Returns:
        the value at the given path, or null if there is no such value.