Skip to content

Enum attributes saved as Enum but read as string #3

Description

The setter of an Enum attribute sets it has a Enum, but the getter is trying to read it as a string. This always result in a ClassCastException being thrown.
Below is an exemple of the setter and getter generated for an Enum attribute.

override fun setMindMapState(v: MindMapState?) {
    if(v == null) removeProperty("mindMapState")
    else putProperty("mindMapState", v)
}
override fun getMindMapState(): MindMapState? {
    val res = getProperty("mindMapState", AsString)
   return if (res != null) enumValueOf<MindMapState>(res) else null
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions