Class CachedConfigObject.Builder<K,V>

java.lang.Object
dev.crafty.core.config.CachedConfigObject.Builder<K,V>
Type Parameters:
K - the type of the key
V - the type of the value
Enclosing class:
CachedConfigObject<K,V>

public static class CachedConfigObject.Builder<K,V> extends Object
Builder for creating instances of CachedConfigObject with custom configuration.
Since:
1.0.5
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • configFile

      public CachedConfigObject.Builder<K,V> configFile(File configFile)
      Sets the config file to use.
      Parameters:
      configFile - the config file
      Returns:
      this builder
    • serializer

      public CachedConfigObject.Builder<K,V> serializer(ConfigSerializer<V> serializer)
      Sets the serializer to use.
      Parameters:
      serializer - the serializer
      Returns:
      this builder
    • configSection

      public CachedConfigObject.Builder<K,V> configSection(String configSection)
      Sets the config section to use.
      Parameters:
      configSection - the config section name
      Returns:
      this builder
    • keyFromStringFunction

      public CachedConfigObject.Builder<K,V> keyFromStringFunction(Function<String,K> keyFromStringFunction)
      Sets the function to convert string keys to keys of type K.
      Parameters:
      keyFromStringFunction - the function to convert string to K
      Returns:
      this builder
    • keyToStringFunction

      public CachedConfigObject.Builder<K,V> keyToStringFunction(Function<K,String> keyToStringFunction)
      Sets the function to convert keys of type K to string keys.
      Parameters:
      keyToStringFunction - the function to convert K to string
      Returns:
      this builder
    • build

      public CachedConfigObject<K,V> build()
      Builds a new CachedConfigObject instance with the configured parameters.
      Returns:
      a new CachedConfigObject instance