Top Description Constructors Methods
org.hibernate.graph

public final Class GraphParser

extends Object
Class Inheritance
Annotations
@SuppressWarnings:unused, WeakerAccess
Imports
javax.persistence.EntityGraph, .EntityManager, .EntityManagerFactory, .Subgraph, org.hibernate.engine.spi.SessionFactoryImplementor, .SessionImplementor, org.hibernate.graph.spi.GraphImplementor, .RootGraphImplementor

Parser for string representations of JPA javax.persistence.EntityGraph (RootGraph) and javax.persistence.Subgraph (SubGraph), using a simple syntax defined by the `graph.g` Antlr grammar.

The parse methods all create a root javax.persistence.EntityGraph based on the passed entity class and parse the graph string into that root graph.

The parseInto methods parse the graph string into a passed graph, which may be a sub-graph

Multiple graphs made for the same entity type can be merged. See EntityGraphs#merge.

Author
asusnjar

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> RootGraph<T>
parse(final Class<T>
The root entity type
rootType
,
final CharSequence
The textual representation of the graph
graphText
,
final EntityManager
The EntityManager
entityManager
)

Creates a root graph based on the passed `rootType` and parses `graphText` into the generated root graph

private static <T> RootGraphImplementor<T>
parse(final Class<T> rootType, final CharSequence graphText, final SessionImplementor session)

Deprecated as a consequence of SessionImplementor being deprecated.
public static <T> void
parseInto(final Graph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManager
The EntityManager
entityManager
)

Parses the textual graph representation into the specified graph.

public static <T> void
parseInto(final EntityGraph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManager
The EntityManager
entityManager
)

Parses the textual graph representation into the specified graph.

public static <T> void
parseInto(final Subgraph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManager
The EntityManager
entityManager
)

Parses the textual graph representation into the specified graph.

public static <T> void
parseInto(final Graph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManagerFactory
The EntityManagerFactory
entityManagerFactory
)

Parses the textual graph representation into the specified graph.

public static <T> void
parseInto(final EntityGraph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManagerFactory
The EntityManagerFactory
entityManagerFactory
)

Parses the textual graph representation into the specified graph.

public static <T> void
parseInto(final Subgraph<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
final EntityManagerFactory
The EntityManagerFactory
entityManagerFactory
)

Parses the textual graph representation into the specified graph.

private static <
The Java type for the ManagedType described by `graph`
T
>
void
parseInto(GraphImplementor<T>
The target graph. This is the graph that will be populated by this process
graph
,
final CharSequence
Textual representation of the graph
graphText
,
SessionFactoryImplementor
The SessionFactory reference
sessionFactory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Parses the textual graph representation as described above into the specified graph.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GraphParserback to summary
public GraphParser()

Method Detail

parseback to summary
public static <T> RootGraph<T> parse(final Class<T> rootType, final CharSequence graphText, final EntityManager entityManager)

Creates a root graph based on the passed `rootType` and parses `graphText` into the generated root graph

API Note

The passed EntityManager is expected to be a Hibernate implementation. Attempting to pass another provider's EntityManager implementation will fail

Parameters
rootType:Class<T>

The root entity type

graphText:CharSequence

The textual representation of the graph

entityManager:EntityManager

The EntityManager

Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseback to summary
private static <T> RootGraphImplementor<T> parse(final Class<T> rootType, final CharSequence graphText, final SessionImplementor session)

Deprecated

as a consequence of SessionImplementor being deprecated. See corresponding docs for further information.

parseIntoback to summary
public static <T> void parseInto(final Graph<T> graph, final CharSequence graphText, final EntityManager entityManager)

Parses the textual graph representation into the specified graph.

Parameters
graph:Graph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManager:EntityManager

The EntityManager

Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
public static <T> void parseInto(final EntityGraph<T> graph, final CharSequence graphText, final EntityManager entityManager)

Parses the textual graph representation into the specified graph.

Parameters
graph:EntityGraph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManager:EntityManager

The EntityManager

Annotations
@SuppressWarnings:unchecked
Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
public static <T> void parseInto(final Subgraph<T> graph, final CharSequence graphText, final EntityManager entityManager)

Parses the textual graph representation into the specified graph.

Parameters
graph:Subgraph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManager:EntityManager

The EntityManager

Annotations
@SuppressWarnings:unchecked
Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
public static <T> void parseInto(final Graph<T> graph, final CharSequence graphText, final EntityManagerFactory entityManagerFactory)

Parses the textual graph representation into the specified graph.

Parameters
graph:Graph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManagerFactory:EntityManagerFactory

The EntityManagerFactory

Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
public static <T> void parseInto(final EntityGraph<T> graph, final CharSequence graphText, final EntityManagerFactory entityManagerFactory)

Parses the textual graph representation into the specified graph.

Parameters
graph:EntityGraph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManagerFactory:EntityManagerFactory

The EntityManagerFactory

Annotations
@SuppressWarnings:unchecked
Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
public static <T> void parseInto(final Subgraph<T> graph, final CharSequence graphText, final EntityManagerFactory entityManagerFactory)

Parses the textual graph representation into the specified graph.

Parameters
graph:Subgraph<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

entityManagerFactory:EntityManagerFactory

The EntityManagerFactory

Annotations
@SuppressWarnings:unchecked
Exceptions
InvalidGraphException:
if the textual representation is invalid.
parseIntoback to summary
private static <T> void parseInto(GraphImplementor<T> graph, final CharSequence graphText, SessionFactoryImplementor sessionFactory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Parses the textual graph representation as described above into the specified graph.

Parameters
<T>
The Java type for the ManagedType described by `graph`
graph:GraphImplementor<T>

The target graph. This is the graph that will be populated by this process

graphText:CharSequence

Textual representation of the graph

sessionFactory:SessionFactoryImplementor

The SessionFactory reference

Exceptions
InvalidGraphException:
if the textual representation is invalid.