Interface Graph<T>

    • Method Detail

      • addAttributeNode

        <Y> AttributeNode<Y> addAttributeNode​(java.lang.String attributeName)
        Get an existing attribute node for the attribute with the given name, or add a new attribute node if there is no existing node.
        Parameters:
        attributeName - name of the attribute
        Returns:
        the attribute node
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.lang.IllegalStateException - if the EntityGraph has been statically defined
        Since:
        3.2
      • addAttributeNode

        <Y> AttributeNode<Y> addAttributeNode​(Attribute<? super T,​Y> attribute)
        Get an existing attribute node for the given attribute, or add a new attribute node if there is no existing node.
        Parameters:
        attribute - attribute
        Returns:
        the attribute node
        Throws:
        java.lang.IllegalStateException - if the EntityGraph has been statically defined
        Since:
        3.2
      • hasAttributeNode

        boolean hasAttributeNode​(java.lang.String attributeName)
        Determine if there is an existing attribute node for the attribute with the given name.
        Parameters:
        attributeName - name of the attribute
        Returns:
        true if there is an existing attribute node
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        Since:
        3.2
      • hasAttributeNode

        boolean hasAttributeNode​(Attribute<? super T,​?> attribute)
        Determine if there is an existing attribute node for the given attribute.
        Parameters:
        attribute - attribute
        Returns:
        true if there is an existing attribute node
        Since:
        3.2
      • getAttributeNode

        <Y> AttributeNode<Y> getAttributeNode​(java.lang.String attributeName)
        Get an existing attribute node for the attribute with the given name.
        Parameters:
        attributeName - name of the attribute
        Returns:
        the attribute node
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.util.NoSuchElementException - if there is no existing node for the attribute
        Since:
        3.2
      • getAttributeNode

        <Y> AttributeNode<Y> getAttributeNode​(Attribute<? super T,​Y> attribute)
        Get an existing attribute node for the given attribute.
        Parameters:
        attribute - attribute
        Returns:
        the attribute node
        Throws:
        java.util.NoSuchElementException - if there is no existing node for the attribute
        Since:
        3.2
      • removeAttributeNode

        void removeAttributeNode​(java.lang.String attributeName)
        Remove an attribute node from the entity graph. When this graph is interpreted as a load graph, this operation suppresses inclusion of an attribute mapped for eager fetching. The effect of this call may be overridden by subsequent invocations of addAttributeNode(java.lang.String) or addSubgraph(jakarta.persistence.metamodel.Attribute<? super T, X>). If there is no existing node for the given attribute name, this operation has no effect.
        Parameters:
        attributeName - name of the attribute
        Since:
        3.2
      • removeAttributeNode

        void removeAttributeNode​(Attribute<? super T,​?> attribute)
        Remove an attribute node from the entity graph. When this graph is interpreted as a load graph, this operation suppresses inclusion of an attribute mapped for eager fetching. The effect of this call may be overridden by subsequent invocations of addAttributeNode(java.lang.String) or addSubgraph(jakarta.persistence.metamodel.Attribute<? super T, X>). If there is no existing node for the given attribute, this operation has no effect.
        Parameters:
        attribute - attribute
        Since:
        3.2
      • addAttributeNodes

        void addAttributeNodes​(java.lang.String... attributeName)
        Add one or more attribute nodes to the entity graph. If there is already an existing node for one of the given attribute names, that particular argument is ignored and has no effect.
        Parameters:
        attributeName - name of the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this managed type.
        java.lang.IllegalStateException - if the EntityGraph has been statically defined
      • addAttributeNodes

        void addAttributeNodes​(Attribute<? super T,​?>... attribute)
        Add one or more attribute nodes to the entity graph. If there is already an existing node for one of the given attributes, that particular argument is ignored and has no effect.
        Parameters:
        attribute - attribute
        Throws:
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph​(Attribute<? super T,​X> attribute)
        Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if the EntityGraph has been statically defined
      • addTreatedSubgraph

        <Y> Subgraph<Y> addTreatedSubgraph​(Attribute<? super T,​? super Y> attribute,
                                           java.lang.Class<Y> type)
        Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if the EntityGraph has been statically defined
        Since:
        3.2
      • addSubgraph

        @Deprecated(since="3.2",
                    forRemoval=true)
        <X> Subgraph<? extends X> addSubgraph​(Attribute<? super T,​X> attribute,
                                              java.lang.Class<? extends X> type)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph​(java.lang.String attributeName)
        Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this managed type.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph​(java.lang.String attributeName,
                                    java.lang.Class<X> type)
        Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
        Parameters:
        attributeName - name of the attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this managed type.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addElementSubgraph

        <E> Subgraph<E> addElementSubgraph​(PluralAttribute<? super T,​?,​E> attribute)
        Add a node to the graph that corresponds to a collection element that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the element attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not an entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
        Since:
        3.2
      • addTreatedElementSubgraph

        <E> Subgraph<E> addTreatedElementSubgraph​(PluralAttribute<? super T,​?,​? super E> attribute,
                                                  java.lang.Class<E> type)
        Add a node to the graph that corresponds to a collection element that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the element attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not an entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
        Since:
        3.2
      • addElementSubgraph

        <X> Subgraph<X> addElementSubgraph​(java.lang.String attributeName)
        Add a node to the graph that corresponds to a collection element that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        Returns:
        subgraph for the element attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addElementSubgraph

        <X> Subgraph<X> addElementSubgraph​(java.lang.String attributeName,
                                           java.lang.Class<X> type)
        Add a node to the graph that corresponds to a collection element that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        type - entity subclass
        Returns:
        subgraph for the element attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addMapKeySubgraph

        <K> Subgraph<K> addMapKeySubgraph​(MapAttribute<? super T,​K,​?> attribute)
        Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the key attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addTreatedMapKeySubgraph

        <K> Subgraph<K> addTreatedMapKeySubgraph​(MapAttribute<? super T,​? super K,​?> attribute,
                                                 java.lang.Class<K> type)
        Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        @Deprecated(since="3.2",
                    forRemoval=true)
        <X> Subgraph<X> addKeySubgraph​(Attribute<? super T,​X> attribute)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the key attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        @Deprecated(since="3.2",
                    forRemoval=true)
        <X> Subgraph<? extends X> addKeySubgraph​(Attribute<? super T,​X> attribute,
                                                 java.lang.Class<? extends X> type)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type entity
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<X> addKeySubgraph​(java.lang.String attributeName)
        Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        Returns:
        subgraph for the key attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<X> addKeySubgraph​(java.lang.String attributeName,
                                       java.lang.Class<X> type)
        Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include the specified attributes of superclass subgraphs
        Parameters:
        attributeName - name of the attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        java.lang.IllegalArgumentException - if the attribute is not an attribute of this entity.
        java.lang.IllegalArgumentException - if the attribute's target type is not a managed type
        java.lang.IllegalStateException - if this EntityGraph has been statically defined
      • getAttributeNodes

        java.util.List<AttributeNode<?>> getAttributeNodes()
        Return the attribute nodes corresponding to the attributes of this managed type that are included in the graph.
        Returns:
        list of attribute nodes included in the graph or an empty list if none have been defined