6.7.11 Discovering the Definition of a Node Type

The NodeType object represents a primary or mixin node type available in the repository.

javax.jcr.nodetype.
NodeType

String

getName()

Returns the name of the node type.

boolean

isMixin()

Returns true if this is a mixin type; returns false if it is primary.

boolean

hasOrderableChildNodes()

Returns true if nodes of this type must support orderable child nodes; returns false otherwise. If a node type returns true on a call to this method, then all nodes of that node type must support the method Node.orderBefore. If a node type returns false on a call to this method, then nodes of that node type may support Node.orderBefore. Only the primary node type of a node controls that node's status in this regard. This setting on a mixin node type will not have any effect on the node. See 7.1.11 Ordering Child Nodes.

String

getPrimaryItemName()

Returns the name of the primary item (one of the child items of the nodes of this node type). If this node has no primary item, then this method returns null. This indicator is used by the method Node.getPrimaryItem(). See 6.2.3 Node Read Methods.

NodeType[]

getSupertypes()

Returns all supertypes of this node type in the node type inheritance hierarchy. For primary types apart from nt:base, this list will always include at least nt:base. For mixin types, there is no required supertype.

NodeType[]

getDeclaredSupertypes()

Returns the direct supertypes of this node type in the node type inheritance hierarchy, that is, those actually declared in this node type. In single-inheritance systems, this will always be an array of size 0 or 1. In systems that support multiple inheritance of node types this array may be of size greater than 1.

boolean

isNodeType(String nodeTypeName)

Returns true if this node type is nodeTypeName or a subtype of nodeTypeName, otherwise returns false.

PropertyDefinition[]

getPropertyDefinitions()

Returns an array containing the property definitions of this node type. This includes both those property definitions actually declared in this node type and those inherited from the supertypes of this type.

PropertyDefinition[]

getDeclaredPropertyDefinitions()

Returns an array containing the property definitions actually declared in this node type.

NodeDefinition[]

getChildNodeDefinitions()

Returns an array containing the child node definitions of this node type. This includes both those child node definitions actually declared in this node type and those inherited from the supertypes of this node type.

NodeDefinition[]

getDeclaredChildNodeDefinitions()

Returns an array containing the child node definitions actually declared in this node type.

boolean

canSetProperty(String propertyName,
Value value)

Returns true if setting propertyName to value is allowed by this node type. Otherwise returns false.

boolean

canSetProperty(String propertyName,
Value[] values)

Returns true if setting propertyName to values is allowed by this node type. Otherwise returns false.

boolean

canAddChildNode(String childNodeName)

Returns true if this node type allows the addition of a child node called childNodeName without specific node type information (that is, given the definition of this parent node type, the child node name is sufficient to determine the intended child node type). Returns false otherwise.

boolean

canAddChildNode(String childNodeName,
String nodeTypeName)

Returns true if this node type allows the addition of a child node called childNodeName of node type nodeTypeName. Returns false otherwise.

boolean

canRemoveItem(String itemName)

Returns true if removing the child item called itemName is allowed by this node type. Returns false otherwise.