org.hibernate.graph.Graph Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beangle-hibernate-core Show documentation
Show all versions of beangle-hibernate-core Show documentation
Hibernate Orm Core Shade,Support Scala Collection
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.graph;
import java.util.List;
import javax.persistence.metamodel.Attribute;
import javax.persistence.metamodel.ManagedType;
/**
* A container for {@link AttributeNode}s.
*
* Acts as a "bridge" between JPA's {@link javax.persistence.EntityGraph} and {@link javax.persistence.Subgraph}
*
* @author Strong Liu
* @author Steve Ebersole
* @author Andrea Boriero
*/
@SuppressWarnings({"unused", "UnusedReturnValue"})
public interface Graph extends GraphNode {
/**
* Graphs apply only to ManagedTypes. Returns the ManagedType being graphed here.
*/
ManagedType getGraphedType();
/**
* Create a named (if passed `name` != null) root Graph. The `mutable`
* parameter controls whether the created Graph is mutable.
*
* @throws CannotBecomeEntityGraphException For named attributes
* that are not entity valued
*/
RootGraph makeRootGraph(String name, boolean mutable) throws CannotBecomeEntityGraphException;
/**
* Create a (mutable/immutable) SubGraph based on this Graph
*/
SubGraph makeSubGraph(boolean mutable);
@Override
Graph makeCopy(boolean mutable);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// AttributeNode handling
/**
* Ultimately only needed for implementing {@link javax.persistence.EntityGraph#getAttributeNodes()}
* and {@link javax.persistence.Subgraph#getAttributeNodes()}
*/
List> getGraphAttributeNodes();
/**
* Find an already existing AttributeNode by attributeName within this
* container
*/
AttributeNode findAttributeNode(String attributeName);
/**
* Find an already existing AttributeNode by corresponding attribute
* reference, within this container
*/
AttributeNode findAttributeNode(Attribute extends J, AJ> attribute);
/**
* Get a list of all existing AttributeNodes within this container
*/
List> getAttributeNodeList();
/**
* Add an AttributeNode (with no associated SubGraphNodes) to this container
* by attribute name
*/
AttributeNode addAttributeNode(String attributeName);
/**
* Add an AttributeNode (with no associated SubGraphNode) to this container
* by Attribute reference
*/
AttributeNode addAttributeNode(Attribute extends J,AJ> attribute);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// sub graph nodes
/**
* Create a (mutable) SubGraphNode associated with the named AttributeNode.
* The created SubGraphNode is returned
*
* @apiNote If no such AttributeNode exists yet, it is created.
*/
SubGraph addSubGraph(String attributeName) throws CannotContainSubGraphException;
SubGraph addSubGraph(String attributeName, Class type) throws CannotContainSubGraphException;
/**
* Create a (mutable) SubGraphNode associated with the AttributeNode for the given
* Attribute. The created SubGraphNode is returned
*
* @apiNote If no such AttributeNode exists yet, it is created.
*/
SubGraph addSubGraph(Attribute extends J, AJ> attribute) throws CannotContainSubGraphException;
SubGraph extends AJ> addSubGraph(Attribute extends J, AJ> attribute, Class extends AJ> type) throws CannotContainSubGraphException;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// key sub graph nodes
SubGraph addKeySubGraph(String attributeName) throws CannotContainSubGraphException;
SubGraph addKeySubGraph(String attributeName, Class type) throws CannotContainSubGraphException;
SubGraph addKeySubGraph(Attribute extends J,AJ> attribute) throws CannotContainSubGraphException;
SubGraph extends AJ> addKeySubGraph(Attribute extends J,AJ> attribute, Class extends AJ> type) throws CannotContainSubGraphException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy