Created
July 21, 2022 18:26
-
-
Save rubenquadros/b33ddf14c290d9b944d6fee5e8ef5fc5 to your computer and use it in GitHub Desktop.
Persisting the plugin settings state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@State( | |
name = "com.ruben.codespector.settings.InspectionSettingState", | |
storages = [Storage("Codespector.xml")] | |
) | |
class InspectionSettingState : | |
PersistentStateComponent<InspectionSettingState> { | |
var parser: Parser = Parser.GSON | |
override fun getState(): InspectionSettingState { | |
return this | |
} | |
override fun loadState(state: InspectionSettingState) { | |
XmlSerializerUtil.copyBean(state, this) | |
} | |
} | |
enum class Parser(val annotation: String) { | |
GSON("SerializedName"), | |
MOSHI("Json"), | |
KOTLINX_SERIALIZATION("SerialName") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment