Class EffectiveNodeType


  • public final class EffectiveNodeType
    extends Object
    Effective node type as defined by JCR 2.0, Chapter 3.7.6.5. The order is an implementation detail (compare with JCR 2.0, Chapter 3.7.7) but this implementation replicates the logic from Oak:
    1. local before inherited types
    2. named primary types (even inherited ones) before named mixin types
    3. residual primary types (even inherited ones) before residual mixin types
    4. all named item definitions should be considered first (of both primary and mixins) and only afterwards the unnamed ones
    5. the first potential match wins (even if it is only for the undefined type and more type-specific definitions follow later)
    • Method Detail

      • ofPrimaryTypeAndMixins

        @NotNull
        public static @NotNull EffectiveNodeType ofPrimaryTypeAndMixins​(@NotNull
                                                                        @NotNull NodeType primaryType,
                                                                        NodeType... mixinTypes)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getApplicablePropertyDefinition

        public Optional<PropertyDefinition> getApplicablePropertyDefinition​(@NotNull
                                                                            @NotNull String name,
                                                                            boolean isMultiple,
                                                                            int type)
        Returns the applicable property definition for the given name and type.
        Parameters:
        name - the property name (must be the qualified name, not the expanded name)
        isMultiple - true if this is a multi-value type otherwise false
        type - the property value type (one of the constants from PropertyType)
        Returns:
        the applicable property definition
      • getApplicableChildNodeDefinition

        public Optional<NodeDefinition> getApplicableChildNodeDefinition​(@NotNull
                                                                         @NotNull String name,
                                                                         @NotNull
                                                                         @NotNull NodeType... types)
        Returns the applicable node definition for the given name and types.
        Parameters:
        name - the child node name
        types - the node types
        Returns:
        the applicable child node definition
      • getDefaultPrimaryChildNodeTypeName

        public Optional<String> getDefaultPrimaryChildNodeTypeName​(@NotNull
                                                                   @NotNull Node parent,
                                                                   @NotNull
                                                                   @NotNull String nodeName)
                                                            throws RepositoryException
        Parameters:
        parent - the node the parent node for which to figure out the default primary type
        nodeName - the name of the to be created node
        Returns:
        the qualified name of the default primary type for the given intermediate node below parent
        Throws:
        RepositoryException