Easy way to suppress persistence of inherited fields

I noticed that the persistence framework started persisting inherited fields once I changed my class hierarchy to extend from `SimpleNode`. When I started adding icons to my tree nodes I now get load errors. I don't want the fields from `SimpleNode` to be considered for serialisation. Is there some way to tell the framework to only persist annotated fields ? Annotating / overriding all possible field sources from `SimpleNode` with Transient would be quite tedious. 

I am thinking I might need to use DTO's for persistence :( I do plan to rework it so it might not be too bad.

abstract class BookmarkNode(
@Attribute override var displayName: String,
@Attribute override var parent: String?,
@Attribute override val id: String
) : SimpleNode(), IDNode {
override fun getName(): String = displayName
}

class BookmarkDirectory(
displayName: String = "",
id: String = UUID.randomUUID().toString(),
parent: String? = "",
@Tag @AbstractCollection(
surroundWithTag = false,
elementTypes = kotlin.arrayOf(blast.browser.components.BookmarkDirectory::class, blast.browser.components.Bookmark::class))
var nodes: java.util.HashSet<BookmarkNode> = java.util.HashSet<BookmarkNode>()
) : BookmarkNode(displayName, parent, id) {
override fun update(presentation: PresentationData) {
super.update(presentation)
presentation.setIcon(AllIcons.Nodes.Folder)
}

override fun isAlwaysLeaf(): Boolean = false
// TODO don't know why this map was/is needed
override fun getChildren(): Array<out SimpleNode> = nodes.map { it }.toTypedArray()
}

Please sign in to leave a comment.