Class ConfigResolver.Builder

java.lang.Object
com.mrivanplays.annotationconfig.core.resolver.ConfigResolver.Builder
Enclosing interface:
ConfigResolver

public static class ConfigResolver.Builder extends Object
Represents a builder of a ConfigResolver
Since:
2.0.0
Author:
MrIvanPlays
  • Constructor Details

  • Method Details

    • copy

      Creates a copy of this builder
      Returns:
      a new builder instance, copy of this builder instance
    • withCommentPrefix

      Sets the comment prefix for the config type you want to generate configs. This cannot be null.
      Parameters:
      val - the config prefix you want to set
      Returns:
      this instance for chaining
    • withValueWriter

      Sets the ValueWriter for the config type you want to generate configs. This cannot be null.
      Parameters:
      val - the value writer you want to set
      Returns:
      this instance for chaining
    • withValueReader

      Sets the value reader for the config type you want to generate configs. This cannot be null.
      Parameters:
      val - the value reader you want to set
      Returns:
      this instance for chaining
    • withOption

      public <T> ConfigResolver.Builder withOption(String key, Option<T> value)
      Binds the specified Option value to the specifed key.
      Type Parameters:
      T - value type
      Parameters:
      key - the key you want this option to be bound to
      value - the value bound
      Returns:
      this instance for chaining
    • withLoadSetting

      public <T> ConfigResolver.Builder withLoadSetting(LoadSetting<T> setting, T value)
      Binds the specified value to the specified LoadSetting setting in the default LoadSettings
      Type Parameters:
      T - value type
      Parameters:
      setting - the setting you want this value to be bound to
      value - the value bound
      Returns:
      this instance for chaining
    • withKeyResolver

      Sets the KeyResolver for the config type you want to generate configs. If null, it will use the default KeyResolver.DEFAULT.
      Parameters:
      resolver - the resolver you want to set
      Returns:
      this instance for chaining
    • shouldReverseFields

      Sets whether to reverse fields when generating options. This is needed for some config types so the generated options are chronological with the annotated config's fields. The default value here is false.
      Parameters:
      val - whether to reverse fields
      Returns:
      this instance for chaining
    • build

      Builds a new ConfigResolver ready for use.
      Returns:
      new config resolver instance