Package dev.crafty.core.config
Class CachedConfigObject.Builder<K,V>
java.lang.Object
dev.crafty.core.config.CachedConfigObject.Builder<K,V>
- Type Parameters:
K
- the type of the keyV
- the type of the value
- Enclosing class:
CachedConfigObject<K,
V>
Builder for creating instances of
CachedConfigObject
with custom configuration.- Since:
- 1.0.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newCachedConfigObject
instance with the configured parameters.configFile
(File configFile) Sets the config file to use.configSection
(String configSection) Sets the config section to use.keyFromStringFunction
(Function<String, K> keyFromStringFunction) Sets the function to convert string keys to keys of type K.keyToStringFunction
(Function<K, String> keyToStringFunction) Sets the function to convert keys of type K to string keys.serializer
(ConfigSerializer<V> serializer) Sets the serializer to use.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
configFile
Sets the config file to use.- Parameters:
configFile
- the config file- Returns:
- this builder
-
serializer
Sets the serializer to use.- Parameters:
serializer
- the serializer- Returns:
- this builder
-
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
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
Builds a newCachedConfigObject
instance with the configured parameters.- Returns:
- a new CachedConfigObject instance
-