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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.util.Optional<javax.jcr.nodetype.NodeDefinition> getApplicableChildNodeDefinition​(@NotNull java.lang.String name, @NotNull javax.jcr.nodetype.NodeType... types)
      Returns the applicable node definition for the given name and types.
      java.util.Optional<javax.jcr.nodetype.NodeDefinition> getApplicableChildNodeDefinition​(@NotNull java.util.function.Predicate<javax.jcr.nodetype.NodeDefinition> predicate, @NotNull java.lang.String name)  
      java.util.Optional<javax.jcr.nodetype.PropertyDefinition> getApplicablePropertyDefinition​(@NotNull java.lang.String name, boolean isMultiple, int type)
      Returns the applicable property definition for the given name and type.
      java.util.Optional<javax.jcr.nodetype.PropertyDefinition> getApplicablePropertyDefinition​(java.util.function.Predicate<javax.jcr.nodetype.PropertyDefinition> predicate, @NotNull java.lang.String name)  
      java.util.Optional<java.lang.String> getDefaultPrimaryChildNodeTypeName​(@NotNull javax.jcr.Node parent, @NotNull java.lang.String nodeName)  
      int hashCode()  
      static @NotNull EffectiveNodeType ofNode​(@NotNull javax.jcr.Node node)  
      static @NotNull EffectiveNodeType ofPrimaryTypeAndMixins​(@NotNull javax.jcr.nodetype.NodeType primaryType, javax.jcr.nodetype.NodeType... mixinTypes)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • ofNode

        @NotNull
        public static @NotNull EffectiveNodeType ofNode​(@NotNull
                                                        @NotNull javax.jcr.Node node)
                                                 throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • ofPrimaryTypeAndMixins

        @NotNull
        public static @NotNull EffectiveNodeType ofPrimaryTypeAndMixins​(@NotNull
                                                                        @NotNull javax.jcr.nodetype.NodeType primaryType,
                                                                        javax.jcr.nodetype.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<javax.jcr.nodetype.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<javax.jcr.nodetype.PropertyDefinition> getApplicablePropertyDefinition​(java.util.function.Predicate<javax.jcr.nodetype.PropertyDefinition> predicate,
                                                                                                         @NotNull
                                                                                                         @NotNull java.lang.String name)
      • getApplicableChildNodeDefinition

        public java.util.Optional<javax.jcr.nodetype.NodeDefinition> getApplicableChildNodeDefinition​(@NotNull
                                                                                                      @NotNull java.lang.String name,
                                                                                                      @NotNull
                                                                                                      @NotNull javax.jcr.nodetype.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<javax.jcr.nodetype.NodeDefinition> getApplicableChildNodeDefinition​(@NotNull
                                                                                                      @NotNull java.util.function.Predicate<javax.jcr.nodetype.NodeDefinition> predicate,
                                                                                                      @NotNull
                                                                                                      @NotNull java.lang.String name)
      • getDefaultPrimaryChildNodeTypeName

        public java.util.Optional<java.lang.String> getDefaultPrimaryChildNodeTypeName​(@NotNull
                                                                                       @NotNull javax.jcr.Node parent,
                                                                                       @NotNull
                                                                                       @NotNull java.lang.String nodeName)
                                                                                throws javax.jcr.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:
        javax.jcr.RepositoryException