What is the difference between jcr:primaryType and jcr:mixinTypes?

后端 未结 3 1679
陌清茗
陌清茗 2021-02-10 06:31

I am just curious to know what is the difference between jcr:primaryType and jcr:mixinTypes, and why exactly does jcr:mixinTypes is used ? what does it signifies ? If you check

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-10 07:19

    First you should note that both properties jcr:primaryType and jcr:mixinTypes are defined in the super node nt:base then inherited by all other nodes.

    The jcr:primaryType property specifies the base type of a node and will be assigned at node's creation time and you can think of it as the BASE class of an object in OO world. It can be done programatically with Node.setPrimaryType('some-primary-type') e.g: nt:file, nt:unstructured...

    The jcr:mixinTypes property is a multi-value one (not a single property value but can have a list) and basically talking can be empty at node's creation since it is not a mondatory property and a node can have no jcr:mixinType at all. The node can get a mixin type added programatically with node.addMixin('some-mixin-type'). You can think of it as interfaces in OO world since a node can have multiple ones and they aim to add aditionnal properties (state/instance variable in OO world) to that node. e.g: mix:versionable, mix:referenceable

提交回复
热议问题