Skip to content

Commit 0966944

Browse files
committed
fix: ConfigFactory.kt
1 parent 2f9040b commit 0966944

File tree

1 file changed

+13
-0
lines changed
  • plugin-shared/src/main/kotlin/app/simplecloud/plugin/api/shared/config

1 file changed

+13
-0
lines changed

plugin-shared/src/main/kotlin/app/simplecloud/plugin/api/shared/config/ConfigFactory.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ import java.io.File
1111
import java.nio.file.*
1212
import kotlin.coroutines.CoroutineContext
1313

14+
/**
15+
* A configuration factory that loads, saves and watches configuration files.
16+
* The factory automatically reloads the configuration when the file changes.
17+
*
18+
* Usage:
19+
* ```
20+
* // Using create
21+
* val factory = ConfigFactory.create<MyConfig>(File("config.yaml"))
22+
*
23+
* // Using create with custom coroutineContext
24+
* val factory = ConfigFactory.create<MyConfig>(File("config.json"), Dispatchers.Default)
25+
* ```
26+
*/
1427
class ConfigFactory(
1528
private val file: File,
1629
private val configClass: Class<*>,

0 commit comments

Comments
 (0)