Skip to content

Add isInitialized method to configuration classes and update version#368

Merged
twisti-dev merged 3 commits into
version/26.1from
feat/is-initialized-config
Jun 8, 2026
Merged

Add isInitialized method to configuration classes and update version#368
twisti-dev merged 3 commits into
version/26.1from
feat/is-initialized-config

Conversation

@twisti-dev

Copy link
Copy Markdown
Contributor

This pull request introduces an isInitialized() method to the configuration class hierarchy, allowing consumers to check if a configuration has been loaded from disk. It also refactors the initialization logic for configuration managers to improve encapsulation and consistency. The project version is incremented as part of this release.

Config system improvements

  • Added the abstract method isInitialized() to SpongeConfigClass, enabling all config types to report their initialization state. [1] [2]
  • Implemented isInitialized() in both SpongeJsonConfigClass and SpongeYmlConfigClass by exposing the state of their respective lazy manager initializations. [1] [2] [3]
  • Refactored the manager initialization in SpongeJsonConfigClass and SpongeYmlConfigClass to use a private managerLazy property, improving encapsulation and allowing access to the initialization state. [1] [2]

Versioning

  • Bumped the project version to 3.19.0 in gradle.properties to reflect these API and implementation changes.

- introduce isInitialized method to check if the config has been loaded from disk
- update SpongeJsonConfigClass and SpongeYmlConfigClass to implement the new method
@twisti-dev twisti-dev self-assigned this Jun 8, 2026
Copilot AI review requested due to automatic review settings June 8, 2026 12:37
@twisti-dev twisti-dev merged commit 7db0de7 into version/26.1 Jun 8, 2026
1 of 5 checks passed
@twisti-dev twisti-dev deleted the feat/is-initialized-config branch June 8, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an initialization-state API to SpongeConfigClass and updates JSON/YML config implementations to expose whether their lazy manager has been created, alongside a version bump.

Changes:

  • Introduce isInitialized() as a new abstract API on SpongeConfigClass.
  • Refactor JSON/YML config classes to use an explicit managerLazy delegate and use it for isInitialized().
  • Bump project version to 3.19.0.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/SpongeYmlConfigClass.kt Refactors manager initialization and adds isInitialized() implementation for YML configs
surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/SpongeJsonConfigClass.kt Refactors manager initialization and adds isInitialized() implementation for JSON configs
surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/SpongeConfigClass.kt Adds new abstract isInitialized() API
surf-api-core/surf-api-core/api/surf-api-core.api Updates published API surface to include isInitialized() and finalizes manager overrides
gradle.properties Version bump to 3.19.0

Comment on lines +36 to 43
private val managerLazy = lazy {
surfConfigApi.createSpongeJsonConfigManager(
configClass,
configFolder,
fileName,
migrationBuilder
)
}
* The manager is created using [SurfConfigApi.createSpongeJsonConfigManager]
* with [configClass], [configFolder], [fileName] and [migrationBuilder].
*/
final override val manager by managerLazy
Comment on lines +81 to +84
/**
* Whether the config has been initialized and loaded from disk.
*/
abstract fun isInitialized(): Boolean
Comment on lines +36 to 43
private val managerLazy = lazy {
surfConfigApi.createSpongeYmlConfigManager(
configClass,
configFolder,
fileName,
migrationBuilder
)
}
Comment on lines +51 to +55
final override val manager by managerLazy

final override fun isInitialized(): Boolean {
return managerLazy.isInitialized()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants