6.7.10 Discovering the Node Types of a Node

Methods are provided for determining the node types of existing nodes:

javax.jcr.
Node

NodeType

getPrimaryNodeType()

Returns the primary node type assigned to this node. Which NodeType is returned when this method is called on the root node of a workspace is up to the implementation, though the returned type must, of course, be consistent with the child nodes and properties of the root node.

A RepositoryException is thrown if an error occurs.

NodeType[]

getMixinNodeTypes()

Returns an array of NodeType objects representing the mixin node types assigned to this node. This includes only those mixin types explicitly assigned to this node, and therefore listed in the property jcr:mixinTypes. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy. See 6.7.22.2 Additions to the Hierarchy.

A RepositoryException is thrown if an error occurs.

boolean

isNodeType(String nodeTypeName)

Returns true if this node is of the specified primary node type or mixin type, or a subtype thereof. Returns false otherwise.

A RepositoryException is thrown if an error occurs.