public interface SemanticValidatorHelper
AbstractSemanticValidator in order to retrieve JPA information.
This helper allows third party adopter to write an instance of this helper that directly access
the JPA information without having to implement Hermes SPI, which can improve performance.
GenericSemanticValidatorHelper is a default implementation that uses 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.
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.util.List<JPQLQueryDeclaration> |
getAllDeclarations()
Returns the ordered list of
JPQLQueryDeclaration, which contain the information
contained in the query's FROM clause. |
java.lang.Object[] |
getConstructors(java.lang.Object type)
Returns the constructors for the given type.
|
java.util.List<JPQLQueryDeclaration> |
getDeclarations()
Returns the ordered list of
JPQLQueryDeclaration, which contain the information
contained in the query's FROM clause. |
java.lang.Object |
getEmbeddable(java.lang.Object type)
Retrieves the embeddable with the given type.
|
java.lang.Object |
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. |
java.lang.Object |
getManagedType(Expression expression)
Returns the managed type by resolving the given
Expression. |
java.lang.Object |
getMappingNamed(java.lang.Object managedType,
java.lang.String name)
Returns the mapping with the given name.
|
java.lang.Object |
getMappingType(java.lang.Object mapping)
Returns the type of the given mapping object.
|
java.lang.Object[] |
getMethodParameterTypeDeclarations(java.lang.Object constructor)
Returns the list of type declarations representing the given constructor's parameter types.
|
java.lang.Object |
getReferenceManagedType(java.lang.Object relationshipMapping)
Returns the reference managed type from the given relationship mapping.
|
java.lang.Object |
getType(Expression expression)
Returns the type by resolving the given
Expression. |
java.lang.Object |
getType(java.lang.Object typeDeclaration)
Returns the type defined for the Java member.
|
java.lang.Object |
getType(java.lang.String typeName)
Retrieves the class with the given fully qualified name.
|
java.lang.Object |
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.
|
void |
newSubqueryContext(SimpleSelectStatement expression)
Changes the state of this helper to use the given subquery.
|
java.lang.Object |
resolveMapping(Expression expression)
Returns the mapping for the field represented by the given
Expression. |
java.lang.Object |
resolveMapping(java.lang.String identificationVariable,
java.lang.String name)
Returns the mapping that should be a persistence field from the entity defined by the given
identification variable.
|
void collectAllDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
FROM clause of the
current query and from the parent queries.identificationVariables - The Map used to store the variablesvoid collectLocalDeclarationIdentificationVariables(java.util.Map<java.lang.String,java.util.List<IdentificationVariable>> identificationVariables)
FROM clause of the
current query.identificationVariables - The Map used to store the variablesvoid disposeSubqueryContext()
java.lang.String[] entityNames()
java.util.List<JPQLQueryDeclaration> getAllDeclarations()
JPQLQueryDeclaration, which contain the information
contained in the query's FROM clause.JPQLQueryDeclaration of the current query that was parsed and from
the parent queriesjava.lang.Object[] 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.
java.util.List<JPQLQueryDeclaration> getDeclarations()
JPQLQueryDeclaration, which contain the information
contained in the query's FROM clause.JPQLQueryDeclaration of the current query that was parsedjava.lang.Object getEmbeddable(java.lang.Object type)
type - The Java type of the embeddable to retrievenull
otherwisejava.lang.Object getEntityNamed(java.lang.String entityName)
entityName - The abstract schema name of the entity to retrievenull otherwisejava.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.
type - The Enum typeJPQLGrammar getGrammar()
JPQLGrammar that defines how the JPQL query was parsed.JPQLGrammar that was used to parse the JPQL queryjava.lang.Object getManagedType(Expression expression)
Expression.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IManagedType IManagedType.
java.lang.Object getMappingNamed(java.lang.Object managedType,
java.lang.String name)
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.
managedType - The managed type that has a mapping with the given namename - The name of the mapping to retrievenull if it could not be foundjava.lang.Object 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.
mapping - The mapping objectjava.lang.Object[] 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.
constructor - The constructor to return its parameter typesjava.lang.Object 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.
relationshipMapping - The relationship mappingjava.lang.Object getType(Expression expression)
Expression.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IType IType.
expression - The Expression to resolveExpression or null if it could not be
validatedjava.lang.Object 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.
java.lang.Object getType(java.lang.String typeName)
If it was going through Hermes SPI, an IType would be returned.
typeName - The fully qualified name of the class to retrievejava.lang.Object 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.
expression - The Expression to resolveExpressionITypeHelper getTypeHelper()
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.
type - The type to retrieve its nameboolean 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.
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 onetrue if type 1 is an instance of the type 2; false otherwiseboolean isCollectionIdentificationVariable(java.lang.String variableName)
variableName - The identification variable to check for what it mapstrue 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 nameboolean 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.
mapping - The mapping object to verify if it represents a collection mappingtrue if the given mapping is a collection mapping; false
otherwiseboolean 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.
true if the given type is an Enum; false otherwiseboolean isIdentificationVariableValidInComparison(IdentificationVariable expression)
expression - The IdentificationVariable that is mapped to either an entity, a
singled-object value field, a collection-valued object fieldtrue if it can be used in a ordering comparison expression; false
if it can'tboolean 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.
true if the given managed type can be located; false if it
could not be foundboolean 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.
mapping - The mapping object to verify if it represents a property mappingtrue if the given mapping is a property mapping; false otherwiseboolean 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.
mapping - The mapping object to verify if it represents a relationship mappingtrue if the given mapping is a relationship mapping; false otherwiseboolean isResultVariable(java.lang.String variableName)
variableName - The variable to check if it's a result variabletrue if the given variable is defined as a result variable;
false otherwiseboolean 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.
mapping - The mapping object to verify if it represents a transient attributetrue if the given attribute is a transient mapping; false otherwiseboolean 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.
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 onetrue if type declaration 1 is an instance of the type declaration 2;
false otherwiseboolean 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.
true if the actual class exists; false otherwisevoid newSubqueryContext(SimpleSelectStatement expression)
expression - The parsed tree representation of the subquery that will become the current querydisposeSubqueryContext()java.lang.Object resolveMapping(Expression expression)
Expression.
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IMapping IMapping.
expression - The Expression representing a state field path expression or a
collection-valued path expressionnull if none existsjava.lang.Object resolveMapping(java.lang.String identificationVariable,
java.lang.String name)
If it was going through Hermes SPI, the return type would be jpa.jpql.spi.IMapping IMapping.
identificationVariable - 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 retrievenull if it could not be found