Class EffectiveNodeType


  • public final class EffectiveNodeType
    extends java.lang.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 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getApplicablePropertyDefinition

        public java.util.Optional<PropertyDefinition> getApplicablePropertyDefinition​(@NotNull
                                                                                      @NotNull java.lang.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
      • getApplicablePropertyDefinition

        public java.util.Optional<PropertyDefinition> getApplicablePropertyDefinition​(java.util.function.Predicate<PropertyDefinition> predicate,
                                                                                      @NotNull
                                                                                      @NotNull java.lang.String name)
      • getApplicableChildNodeDefinition

        public java.util.Optional<NodeDefinition> getApplicableChildNodeDefinition​(@NotNull
                                                                                   @NotNull java.lang.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
      • getApplicableChildNodeDefinition

        public java.util.Optional<NodeDefinition> getApplicableChildNodeDefinition​(@NotNull
                                                                                   @NotNull java.util.function.Predicate<NodeDefinition> predicate,
                                                                                   @NotNull
                                                                                   @NotNull java.lang.String name)
      • getDefaultPrimaryChildNodeTypeName

        public java.util.Optional<java.lang.String> getDefaultPrimaryChildNodeTypeName​(@NotNull
                                                                                       @NotNull Node parent,
                                                                                       @NotNull
                                                                                       @NotNull java.lang.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