Interface ConfigResolver

All Known Implementing Classes:
ConfigResolverImpl

public interface ConfigResolver
Represents a resolver of configurations.

Should be used for implementing new configuration types

Since:
2.0.0
Author:
MrIvanPlays
  • Method Details

    • newBuilder

      Returns:
      new builder
    • options

      Returns the CustomOptions instance.
      Returns:
      options
      See Also:
    • dump

      void dump(Object annotatedConfig, File file)
      Dumps the specified annotatedConfig to the specified File file. If, at the time of calling this method, the file exists, it will get deleted ( default implementation ).

      If you are going to call load(Object, File, LoadSettings) after calling this method, consider using loadOrDump(Object, File, LoadSettings) rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.

      Parameters:
      annotatedConfig - the annotated config you want to dump
      file - the file you want to dump the annotated config to
    • dump

      default void dump(Object annotatedConfig, OutputStream os)
      Dumps the specified annotatedConfig to the specified OutputStream os.
      Parameters:
      annotatedConfig - the annotated config you want to dump
      os - the output stream to dump the annotated config to
    • dump

      void dump(Object annotatedConfig, Writer writer)
      Dumps the specified annotatedConfig to the specified Writer writer.
      Parameters:
      annotatedConfig - the annotated config you want to dump
      writer - the writer to dump the annotated config to
    • load

      void load(Object annotatedConfig, File file)
      Loads the specified annotatedConfig from the specified File file using the default LoadSettings from the builder of this config resolver, or LoadSettings.getDefault().

      If you have called dump(Object, File) before calling this method, consider using loadOrDump(Object, File) rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      file - the file you want to load
    • load

      void load(Object annotatedConfig, File file, LoadSettings loadSettings)
      Loads the specified annotatedConfig from the specified File file using the LoadSettings loadSettings specified.

      If you have called dump(Object, File) before calling this method, consider using loadOrDump(Object, File, LoadSettings) rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      file - the file you want to load
      loadSettings - the load settings
    • load

      default void load(Object annotatedConfig, InputStream in)
      Loads the specified annotatedConfig from the specified InputStream in using the default LoadSettings from the builder of this config resolver, or LoadSettings.getDefault().

      If you have a File instance before calling that, consider using load(Object, File). This way you allow AnnotatedConfig to generate missing options if the load settings allow it.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      in - the input stream you want to load
    • load

      default void load(Object annotatedConfig, InputStream in, LoadSettings loadSettings)
      Loads the specified annotatedConfig from the specified InputStream in using the LoadSettings loadSettings specified.

      If you have a File instance before calling that, consider using load(Object, File, LoadSettings). This way you allow AnnotatedConfig to generate missing options if the load settings allow it.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      in - the input stream you want to load
      loadSettings - the load settings
    • load

      void load(Object annotatedConfig, Reader reader)
      Loads the specified annotatedConfig from the specified Reader reader using the default LoadSettings from the builder of this config resolver, or LoadSettings.getDefault().

      If you have a File instance before calling that, consider using load(Object, File). This way you allow AnnotatedConfig to generate missing options if the load settings allow it.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      reader - the reader you want to load
    • load

      void load(Object annotatedConfig, Reader reader, LoadSettings loadSettings)
      Loads the specified annotatedConfig from the specified Reader reader using the LoadSettings loadSettings specified.

      If you have a File instance before calling that, consider using load(Object, File, LoadSettings). This way you allow AnnotatedConfig to generate missing options if the load settings allow it.

      Parameters:
      annotatedConfig - the annotated config you want to load to
      reader - the reader you want to load
      loadSettings - the load settings
    • loadOrDump

      void loadOrDump(Object annotatedConfig, File file)
      Loads the specified annotatedConfig from the specified File file, if it exists, if not, dumps the specified annotatedConfig to the specified file, using the default LoadSettings from the builder of this config resolver, or LoadSettings.getDefault().
      Parameters:
      annotatedConfig - the annotated config you want to load/dump
      file - the file you want to load/dump to
    • loadOrDump

      void loadOrDump(Object annotatedConfig, File file, LoadSettings loadSettings)
      Loads the specified annotatedConfig from the specified File file, if it exists, if not, dumps the specified annotatedConfig to the specified file, using the LoadSettings loadSettings specified.
      Parameters:
      annotatedConfig - the annotated config you want to load/dump
      file - the file you want to load/dump to
      loadSettings - the load settings