|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.GenericSemanticValidatorHelper
public class GenericSemanticValidatorHelper
An implementation of SemanticValidatorHelper
that uses JPQLQueryContext
to return
the required information and Hermes SPI.
Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Constructor Summary | |
---|---|
GenericSemanticValidatorHelper(JPQLQueryContext queryContext)
Creates a new GenericSemanticValidatorHelper . |
Method Summary | |
---|---|
void |
collectAllDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
Collects the identification variables that are defined in the FROM clause of the
current query and from the parent queries. |
void |
collectLocalDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
Collects the identification variables that are defined in the FROM clause of the
current query. |
void |
disposeSubqueryContext()
Disposes this context, which is the current context being used by a subquery. |
java.lang.String[] |
entityNames()
Returns the name of the all entities that are present in the context of a persistence unit. |
IConstructor[] |
getConstructors(java.lang.Object type)
Returns the constructors for the given type. |
java.util.List |
getDeclarations()
Returns the ordered list of JPQLQueryDeclaration , which contain the information
contained in the query's FROM clause. |
IManagedType |
getEmbeddable(java.lang.Object type)
Retrieves the embeddable with the given type. |
IEntity |
getEntityNamed(java.lang.String entityName)
Retrieves the entity with the given entity name. |
java.lang.String[] |
getEnumConstants(java.lang.Object type)
Returns the constant names for the given Enum type. |
JPQLGrammar |
getGrammar()
Returns the JPQLGrammar that defines how the JPQL query was parsed. |
IManagedType |
getManagedType(Expression expression)
Returns the managed type by resolving the given Expression . |
IMapping |
getMappingNamed(java.lang.Object managedType,
java.lang.String path)
Returns the mapping with the given name. |
IType |
getMappingType(java.lang.Object mapping)
Returns the type of the given mapping object. |
ITypeDeclaration[] |
getMethodParameterTypeDeclarations(java.lang.Object constructor)
Returns the list of type declarations representing the given constructor's parameter types. |
IManagedType |
getReferenceManagedType(java.lang.Object relationshipMapping)
Returns the reference managed type from the given relationship mapping. |
IType |
getType(Expression expression)
Returns the type by resolving the given Expression . |
IType |
getType(java.lang.Object typeDeclaration)
Returns the type defined for the Java member. |
IType |
getType(java.lang.String typeName)
Retrieves the class with the given fully qualified name. |
ITypeDeclaration |
getTypeDeclaration(Expression expression)
Returns the type declaration for the given Expression 's type. |
ITypeHelper |
getTypeHelper()
Returns the helper that gives access to the most common class metadata. |
java.lang.String |
getTypeName(java.lang.Object type)
Returns the fully qualified class name of the given type. |
boolean |
isAssignableTo(java.lang.Object type1,
java.lang.Object type2)
Determines whether type 1 is an instance of type 2. |
boolean |
isCollectionIdentificationVariable(java.lang.String variableName)
Determines whether the given identification variable is defining a join or a collection member declaration expressions. |
boolean |
isCollectionMapping(java.lang.Object mapping)
Determines whether the given mapping is a collection type mapping. |
boolean |
isEnumType(java.lang.Object type)
Determines whether the given type represents an Enum . |
boolean |
isIdentificationVariableValidInComparison(IdentificationVariable expression)
Determines whether an identification variable can be used in a comparison expression when the operator is either '<', '<=', '>', '>='. |
boolean |
isManagedTypeResolvable(java.lang.Object managedType)
Determines whether the given managed type actually exists. |
boolean |
isPropertyMapping(java.lang.Object mapping)
Determines whether the given mapping is a property type mapping. |
boolean |
isRelationshipMapping(java.lang.Object mapping)
Determines whether the given mapping is a relationship type mapping. |
boolean |
isResultVariable(java.lang.String variableName)
Determines if the given variable is a result variable. |
boolean |
isTransient(java.lang.Object mapping)
Determines whether the given mapping is a transient attribute. |
boolean |
isTypeDeclarationAssignableTo(java.lang.Object typeDeclaration1,
java.lang.Object typeDeclaration2)
Determines whether type declaration 1 is an instance of type declaration 2. |
boolean |
isTypeResolvable(java.lang.Object type)
Determines whether the given type actually exists. |
boolean |
isValidatingPathExpressionAllowed(StateFieldPathExpression expression)
Determines whether a path expression should be validated or not. |
void |
newSubqueryContext(SimpleSelectStatement expression)
Changes the state of this helper to use the given subquery. |
IMapping |
resolveMapping(Expression expression)
Returns the mapping for the field represented by the given Expression . |
IMapping |
resolveMapping(java.lang.String variableName,
java.lang.String name)
Returns the mapping that should be a persistence field from the entity defined by the given identification variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericSemanticValidatorHelper(JPQLQueryContext queryContext)
GenericSemanticValidatorHelper
.
queryContext
- The context used to query information about the JPQL query
java.lang.NullPointerException
- The given JPQLQueryContext
cannot be null
Method Detail |
---|
public void collectAllDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
FROM
clause of the
current query and from the parent queries.
collectAllDeclarationIdentificationVariables
in interface SemanticValidatorHelper
identificationVariables
- The Map
used to store the variablespublic void collectLocalDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
FROM
clause of the
current query.
collectLocalDeclarationIdentificationVariables
in interface SemanticValidatorHelper
identificationVariables
- The Map
used to store the variablespublic void disposeSubqueryContext()
disposeSubqueryContext
in interface SemanticValidatorHelper
public java.lang.String[] entityNames()
entityNames
in interface SemanticValidatorHelper
public IConstructor[] getConstructors(java.lang.Object type)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IType IType
and the return type would be persistence.jpa.jpql.spi.IConstructor IConstructor
.
getConstructors
in interface SemanticValidatorHelper
public java.util.List getDeclarations()
JPQLQueryDeclaration
, which contain the information
contained in the query's FROM
clause.
getDeclarations
in interface SemanticValidatorHelper
JPQLQueryDeclaration
of the current query that was parsedpublic IManagedType getEmbeddable(java.lang.Object type)
getEmbeddable
in interface SemanticValidatorHelper
type
- The Java type of the embeddable to retrieve
null
otherwisepublic IEntity getEntityNamed(java.lang.String entityName)
getEntityNamed
in interface SemanticValidatorHelper
entityName
- The abstract schema name of the entity to retrieve
null
otherwisepublic java.lang.String[] getEnumConstants(java.lang.Object type)
Enum
type.
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IType IType
.
getEnumConstants
in interface SemanticValidatorHelper
type
- The Enum
type
public JPQLGrammar getGrammar()
JPQLGrammar
that defines how the JPQL query was parsed.
getGrammar
in interface SemanticValidatorHelper
JPQLGrammar
that was used to parse the JPQL querypublic IManagedType getManagedType(Expression expression)
Expression
.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IManagedType IManagedType
.
getManagedType
in interface SemanticValidatorHelper
public IMapping getMappingNamed(java.lang.Object managedType, java.lang.String path)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IManagedType IManagedType
and the return type would be IMapping
.
getMappingNamed
in interface SemanticValidatorHelper
managedType
- The managed type that has a mapping with the given namepath
- The name of the mapping to retrieve
null
if it could not be foundpublic IType getMappingType(java.lang.Object mapping)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IMapping IMapping
and the return type would be persistence.jpa.jpql.spi.IType IType
.
getMappingType
in interface SemanticValidatorHelper
mapping
- The mapping object
public ITypeDeclaration[] getMethodParameterTypeDeclarations(java.lang.Object constructor)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IConstructor IConstructor
and the return type would be ITypeDeclaration
.
getMethodParameterTypeDeclarations
in interface SemanticValidatorHelper
constructor
- The constructor to return its parameter types
public IManagedType getReferenceManagedType(java.lang.Object relationshipMapping)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IMapping IMapping
and the return type would be IManagedType
.
getReferenceManagedType
in interface SemanticValidatorHelper
relationshipMapping
- The relationship mapping
public IType getType(Expression expression)
Expression
.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IType IType
.
getType
in interface SemanticValidatorHelper
expression
- The Expression
to resolve
Expression
or null
if it could not be
validatedpublic IType getType(java.lang.Object typeDeclaration)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.ITypeDeclaration ITypeDeclaration
and the return type would be
IType
.
getType
in interface SemanticValidatorHelper
public IType getType(java.lang.String typeName)
If it was going through Hermes SPI, an IType
would be returned.
getType
in interface SemanticValidatorHelper
typeName
- The fully qualified name of the class to retrieve
public ITypeDeclaration getTypeDeclaration(Expression expression)
Expression
's type.
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.ITypeDeclaration ITypeDeclaration
.
getTypeDeclaration
in interface SemanticValidatorHelper
expression
- The Expression
to resolve
Expression
public ITypeHelper getTypeHelper()
getTypeHelper
in interface SemanticValidatorHelper
public java.lang.String getTypeName(java.lang.Object type)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IType IType
.
getTypeName
in interface SemanticValidatorHelper
type
- The type to retrieve its name
public boolean isAssignableTo(java.lang.Object type1, java.lang.Object type2)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.IType IType
.
isAssignableTo
in interface SemanticValidatorHelper
type1
- The type to check if it is an instance of type 2type2
- The type used to determine if the class represented by type 1 is an instance
of with one
true
if type 1 is an instance of the type 2; false
otherwisepublic boolean isCollectionIdentificationVariable(java.lang.String variableName)
isCollectionIdentificationVariable
in interface SemanticValidatorHelper
variableName
- The identification variable to check for what it maps
true
if the given identification variable maps a collection-valued field
defined in a JOIN
or IN
expression; false
if it's not
defined or it's mapping an abstract schema namepublic boolean isCollectionMapping(java.lang.Object mapping)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.IMapping IMapping
.
isCollectionMapping
in interface SemanticValidatorHelper
mapping
- The mapping object to verify if it represents a collection mapping
true
if the given mapping is a collection mapping; false
otherwisepublic boolean isEnumType(java.lang.Object type)
Enum
.
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IType IType
.
isEnumType
in interface SemanticValidatorHelper
true
if the given type is an Enum
; false
otherwisepublic boolean isIdentificationVariableValidInComparison(IdentificationVariable expression)
isIdentificationVariableValidInComparison
in interface SemanticValidatorHelper
expression
- The IdentificationVariable
that is mapped to either an entity, a
singled-object value field, a collection-valued object field
true
if it can be used in a ordering comparison expression; false
if it can'tpublic boolean isManagedTypeResolvable(java.lang.Object managedType)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IManagedType IManagedType
.
isManagedTypeResolvable
in interface SemanticValidatorHelper
true
if the given managed type can be located; false
if it
could not be foundpublic boolean isPropertyMapping(java.lang.Object mapping)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.IMapping IMapping
.
isPropertyMapping
in interface SemanticValidatorHelper
mapping
- The mapping object to verify if it represents a property mapping
true
if the given mapping is a property mapping; false
otherwisepublic boolean isRelationshipMapping(java.lang.Object mapping)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.IMapping IMapping
.
isRelationshipMapping
in interface SemanticValidatorHelper
mapping
- The mapping object to verify if it represents a relationship mapping
true
if the given mapping is a relationship mapping; false
otherwisepublic boolean isResultVariable(java.lang.String variableName)
isResultVariable
in interface SemanticValidatorHelper
variableName
- The variable to check if it's a result variable
true
if the given variable is defined as a result variable;
false
otherwisepublic boolean isTransient(java.lang.Object mapping)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.IMapping IMapping
.
isTransient
in interface SemanticValidatorHelper
mapping
- The mapping object to verify if it represents a transient attribute
true
if the given attribute is a transient mapping; false
otherwisepublic boolean isTypeDeclarationAssignableTo(java.lang.Object typeDeclaration1, java.lang.Object typeDeclaration2)
If it was going through Hermes SPI, the type of the arguments would be persistence.jpa.jpql.spi.ITypeDeclaration ITypeDeclaration
.
isTypeDeclarationAssignableTo
in interface SemanticValidatorHelper
typeDeclaration1
- The type declaration to check if it is an instance of type declaration 2typeDeclaration2
- The type used to determine if the class represented by type
declaration 1 is an instance of with one
true
if type declaration 1 is an instance of the type declaration 2;
false
otherwisepublic boolean isTypeResolvable(java.lang.Object type)
If it was going through Hermes SPI, the type of the argument would be persistence.jpa.jpql.spi.IType IType
.
isTypeResolvable
in interface SemanticValidatorHelper
true
if the actual class exists; false
otherwisepublic boolean isValidatingPathExpressionAllowed(StateFieldPathExpression expression)
isValidatingPathExpressionAllowed
in interface SemanticValidatorHelper
expression
- The StateFieldPathExpression
that might not need to be validated
true
to validate the given path expression; false
otherwisepublic void newSubqueryContext(SimpleSelectStatement expression)
newSubqueryContext
in interface SemanticValidatorHelper
expression
- The parsed tree representation of the subquery that will become the current querySemanticValidatorHelper.disposeSubqueryContext()
public IMapping resolveMapping(Expression expression)
Expression
.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IMapping IMapping
.
resolveMapping
in interface SemanticValidatorHelper
expression
- The Expression
representing a state field path expression or a
collection-valued path expression
null
if none existspublic IMapping resolveMapping(java.lang.String variableName, java.lang.String name)
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IMapping IMapping
.
resolveMapping
in interface SemanticValidatorHelper
variableName
- The identification variable that is defined in the FROM
clause of the query (which can be in the current subquery) or in one of the parent queries.name
- The name of the persistent field to retrieve
null
if it could not be found
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |