Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.jpa.jpql

public final Class ConstructorQueryMappings

extends Object
Class Inheritance
Imports
java.util.Collections, .LinkedList, .List, org.eclipse.persistence.config.PersistenceUnitProperties, org.eclipse.persistence.dynamic.DynamicClassLoader, org.eclipse.persistence.jpa.jpql.parser.AbstractEclipseLinkExpressionVisitor, .AbstractPathExpression, .CollectionExpression, .CollectionValuedPathExpression, .ConstructorExpression, .JPQLExpression, .JPQLGrammar, .SelectClause, .SelectStatement, .StateFieldPathExpression, org.eclipse.persistence.mappings.DatabaseMapping, org.eclipse.persistence.queries.DatabaseQuery

This object scans a DatabaseQuery and checks if it's a constructor query. If it is one, then the fully qualified class name and the persistent fields will be available.
Author
Pascal Filion
Since
2.5
Version
2.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ConstructorQueryMappings.ConstructorItemVisitor

This visitor visits the constructor items and adds the attribute type mapped to the name.

private class
ConstructorQueryMappings.ConstructorVisitor

Visits the JPQL query and gather the information contained in the constructor expressions.

Field Summary

Modifier and TypeField and Description
private String
className

The fully qualified class name defined in the constructor expression if one is defined, otherwise null.

private List<DatabaseMapping>
mappings

The list of DatabaseMapping representing the parameter arguments if the JPQL query does contain a constructor expression.

private DatabaseQuery
query

The DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.

Constructor Summary

AccessConstructor and Description
pack-priv
ConstructorQueryMappings(DatabaseQuery
The DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.
query
)

Creates a new ConstructorQueryMappings.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

Either the fully qualified class name used in the constructor expression or null if the query is not a constructor query
getClassName
()

Returns the class name used to define the constructor expression.

public DatabaseQuery

Returns:

The DatabaseQuery that was scanned
getQuery
()

Returns the DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.

public boolean

Returns:

true if the SELECT clause has a single select item and it's a constructor expression; false otherwise
isConstructorQuery
()

Determines whether the JPQL query is a constructor query, i.e. the select expression is a constructor expression.

public Iterable<DatabaseMapping>

Returns:

The list contains the persistent fields that were passed to the constructor
mappings
()

Returns a non-null Iterable over the ordered list of DatabaseMapping objects that represents the parameter arguments defined in the constructor expression.

pack-priv void
populate(JPQLGrammar
The JPQLGrammar how the JPQL query is parsed
jpqlGrammar
)

Populates this object by scanning the JPQL query using the given JPQL grammar.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNameback to summary
private String className

The fully qualified class name defined in the constructor expression if one is defined, otherwise null.

mappingsback to summary
private List<DatabaseMapping> mappings

The list of DatabaseMapping representing the parameter arguments if the JPQL query does contain a constructor expression.

queryback to summary
private DatabaseQuery query

The DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.

Constructor Detail

ConstructorQueryMappingsback to summary
pack-priv ConstructorQueryMappings(DatabaseQuery query)

Creates a new ConstructorQueryMappings.

Parameters
query:DatabaseQuery

The DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.

Method Detail

getClassNameback to summary
public String getClassName()

Returns the class name used to define the constructor expression.

Returns:String

Either the fully qualified class name used in the constructor expression or null if the query is not a constructor query

getQueryback to summary
public DatabaseQuery getQuery()

Returns the DatabaseQuery for which its JPQL query was scanned to check if it's constructor query and if so, to gather the information.

Returns:DatabaseQuery

The DatabaseQuery that was scanned

isConstructorQueryback to summary
public boolean isConstructorQuery()

Determines whether the JPQL query is a constructor query, i.e. the select expression is a constructor expression.

Example: SELECT new test.example.Employee(e.name, e.id) FROM Employee e

Returns:boolean

true if the SELECT clause has a single select item and it's a constructor expression; false otherwise

mappingsback to summary
public Iterable<DatabaseMapping> mappings()

Returns a non-null Iterable over the ordered list of DatabaseMapping objects that represents the parameter arguments defined in the constructor expression.

Returns:Iterable<DatabaseMapping>

The list contains the persistent fields that were passed to the constructor

populateback to summary
pack-priv void populate(JPQLGrammar jpqlGrammar)

Populates this object by scanning the JPQL query using the given JPQL grammar.

Parameters
jpqlGrammar:JPQLGrammar

The JPQLGrammar how the JPQL query is parsed

org.eclipse.persistence.internal.jpa.jpql back to summary

private Class ConstructorQueryMappings.ConstructorItemVisitor

extends AbstractEclipseLinkExpressionVisitor
Class Inheritance

This visitor visits the constructor items and adds the attribute type mapped to the name.

Example:

e.name -> "name" : String

e.address.zipcode -> "zipcode" : int

Field Summary

Modifier and TypeField and Description
private final JPQLQueryContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
private void
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractEclipseLinkExpressionVisitor:
visitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisit

Field Detail

queryContextback to summary
private final JPQLQueryContext queryContext

Constructor Detail

ConstructorItemVisitorback to summary
pack-priv ConstructorItemVisitor(JPQLQueryContext queryContext)

Method Detail

visitback to summary
public void visit(CollectionExpression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the CollectionExpression expression.

Parameters
expression:CollectionExpression

The Expression to visit

Annotations
@Override
visitback to summary
public void visit(CollectionValuedPathExpression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the CollectionValuedPathExpression expression.

Parameters
expression:CollectionValuedPathExpression

The Expression to visit

Annotations
@Override
visitback to summary
public void visit(StateFieldPathExpression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the StateFieldPathExpression expression.

Parameters
expression:StateFieldPathExpression

The Expression to visit

Annotations
@Override
visitPathExpressionback to summary
private void visitPathExpression(AbstractPathExpression expression)
org.eclipse.persistence.internal.jpa.jpql back to summary

private Class ConstructorQueryMappings.ConstructorVisitor

extends AbstractEclipseLinkExpressionVisitor
Class Inheritance

Visits the JPQL query and gather the information contained in the constructor expressions.

Field Summary

Modifier and TypeField and Description
private final JPQLQueryContext

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private DynamicClassLoader
public void
public void
public void
public void
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractEclipseLinkExpressionVisitor:
visitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisitvisit

Field Detail

queryContextback to summary
private final JPQLQueryContext queryContext

Constructor Detail

ConstructorVisitorback to summary
pack-priv ConstructorVisitor(JPQLQueryContext queryContext)

Method Detail

classLoaderback to summary
private DynamicClassLoader classLoader()
visitback to summary
public void visit(ConstructorExpression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the ConstructorExpression expression.

Parameters
expression:ConstructorExpression

The Expression to visit

Annotations
@Override
visitback to summary
public void visit(JPQLExpression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the JPQLExpression expression.

Parameters
expression:JPQLExpression

The Expression to visit

Annotations
@Override
visitback to summary
public void visit(SelectClause expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the SelectClause expression.

Parameters
expression:SelectClause

The Expression to visit

Annotations
@Override
visitback to summary
public void visit(SelectStatement expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpressionVisitor.visit.

Implements org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Doc from org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor.visit.

Visits the SelectStatement expression.

Parameters
expression:SelectStatement

The Expression to visit

Annotations
@Override