Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.jpa.internal.jpql
Class AbstractVisitor

java.lang.Object
  extended by org.eclipse.persistence.jpa.internal.jpql.parser.AnonymousExpressionVisitor
      extended by org.eclipse.persistence.jpa.internal.jpql.AbstractVisitor

All Implemented Interfaces:
ExpressionVisitor
Direct Known Subclasses:
AbstractValidator, ContentAssistVisitor

public abstract class AbstractVisitor
extends AnonymousExpressionVisitor

An abstract class that provides helper methods for quick access to the JPQLQueryContext's methods.

Since:
2.3
Version:
2.3
Author:
Pascal Filion

Nested Class Summary
private static class AbstractVisitor.CollectionExpressionVisitor
          This visitor retrieves the CollectionExpression if it is visited.
private static class AbstractVisitor.ManagedTypeVisitor
           
private static class AbstractVisitor.NullExpressionVisitor
          This visitor checks to see if the visited expression is NullExpression.

 

Field Summary
private  AbstractVisitor.CollectionExpressionVisitor collectionExpressionVisitor
          This visitor determines whether the visited Expression is the CollectionExpression.
private  AbstractVisitor.ManagedTypeVisitor managedTypeVisitor
          This visitor simply determines what type of IManagedType that was visited.
private  AbstractVisitor.NullExpressionVisitor nullExpressionVisitor
          This visitor determines whether the visited Expression is the NullExpression.
protected  JPQLQueryContext queryContext
          The context used to query information about the query.

 

Constructor Summary
protected AbstractVisitor(JPQLQueryContext queryContext)
          Creates a new AbstractVisitor.

 

Method Summary
protected  CollectionExpression collectionExpression(Expression expression)
          Casts the given Expression to a CollectionExpression if it is actually an object of that type.
private  AbstractVisitor.CollectionExpressionVisitor collectionExpressionVisitor()
           
 void dispose()
          Disposes of the internal data.
protected  IEmbeddable embeddable(IManagedType managedType)
          Returns the given IManagedType if it is an IEmbeddable.
protected  IEntity entity(IManagedType managedType)
          Returns the given IManagedType if it is an IEntity.
protected  IJPAVersion getJPAVersion()
          Returns the version of the Java Persistence this entity for which it was defined.
protected  IManagedType getManagedType(IType type)
          Retrieves the entity for the given type.
protected  IManagedType getManagedType(java.lang.String abstractSchemaName)
          Retrieves the entity with the given abstract schema name, which can also be the entity class name.
protected  IMapping getMapping(Expression expression)
          Returns the IMapping for the field represented by the given Expession.
protected  IManagedTypeProvider getProvider()
          Retrieves the provider of managed types.
protected  IQuery getQuery()
          Returns the external form of the JPQL query.
protected  java.lang.String getQueryExpression()
          Returns the string representation of the JPQL query.
protected  Resolver getResolver(Expression expression)
          Creates or retrieved the cached Resolver for the given Expression.
protected  IType getType(java.lang.Class<?> type)
          Retrieves the external type for the given Java type.
protected  IType getType(Expression expression)
          Returns the IType of the given Expression.
protected  IType getType(java.lang.String name)
          Retrieves the external class for the given fully qualified class name.
protected  ITypeDeclaration getTypeDeclaration(Expression expression)
          Returns the ITypeDeclaration of the field handled by this Resolver.
protected  TypeHelper getTypeHelper()
          Returns a helper that gives access to the most common types.
protected  ITypeRepository getTypeRepository()
          Returns the type repository for the application.
protected  void initialize()
          Initializes this class.
protected  boolean isEclipseLinkPlatform()
          Determines whether the platform is EclipseLink.
protected  boolean isEmbeddable(IManagedType managedType)
          Determines whether the given IManagedType is an IEmbeddable.
protected  boolean isEntity(IManagedType managedType)
          Determines whether the given IManagedType is an IEntity.
protected  boolean isJavaPlatform()
          Determines whether the platform is pure JPA (generic).
protected  boolean isMappedSuperclass(IManagedType managedType)
          Determines whether the given IManagedType is an IMappedSuperclass.
protected  boolean isNull(Expression expression)
          Determines whether the given Expression is the NullExpression.
private  AbstractVisitor.ManagedTypeVisitor managedTypeVisitor()
           
protected  IMappedSuperclass mappedSuperclass(IManagedType managedType)
          Returns the given IManagedType if it is an IMappedSuperclass.
private  AbstractVisitor.NullExpressionVisitor nullExpressionVisitor()
           
protected abstract  void visit(Expression expression)
          Blindly visit the given Expression.

 

Methods inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AnonymousExpressionVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

collectionExpressionVisitor

private AbstractVisitor.CollectionExpressionVisitor collectionExpressionVisitor
This visitor determines whether the visited Expression is the CollectionExpression.

managedTypeVisitor

private AbstractVisitor.ManagedTypeVisitor managedTypeVisitor
This visitor simply determines what type of IManagedType that was visited.

nullExpressionVisitor

private AbstractVisitor.NullExpressionVisitor nullExpressionVisitor
This visitor determines whether the visited Expression is the NullExpression.

queryContext

protected final JPQLQueryContext queryContext
The context used to query information about the query.

Constructor Detail

AbstractVisitor

protected AbstractVisitor(JPQLQueryContext queryContext)
Creates a new AbstractVisitor.
Parameters:
queryContext - The context used to query information about the query

Method Detail

collectionExpression

protected final CollectionExpression collectionExpression(Expression expression)
Casts the given Expression to a CollectionExpression if it is actually an object of that type.
Parameters:
expression - The Expression to cast
Returns:
The given Expression if it is a CollectionExpression or null if it is any other object

collectionExpressionVisitor

private AbstractVisitor.CollectionExpressionVisitor collectionExpressionVisitor()

dispose

public void dispose()
Disposes of the internal data.

embeddable

protected IEmbeddable embeddable(IManagedType managedType)
Returns the given IManagedType if it is an IEmbeddable.
Parameters:
managedType - The IManagedType to check if it's an IEmbeddable
Returns:
The given IManagedType cast as IEmbeddable or null if it is not an IEmbeddable

entity

protected IEntity entity(IManagedType managedType)
Returns the given IManagedType if it is an IEntity.
Parameters:
managedType - The IManagedType to check if it's an IEntity
Returns:
The given IManagedType cast as IEntity or null if it is not an IEntity

getJPAVersion

protected IJPAVersion getJPAVersion()
Returns the version of the Java Persistence this entity for which it was defined.
Returns:
The version of the Java Persistence being used

getManagedType

protected IManagedType getManagedType(IType type)
Retrieves the entity for the given type.
Parameters:
type - The type that is used as a managed type
Returns:
The managed type for the given type, if one exists, null otherwise

getManagedType

protected IManagedType getManagedType(java.lang.String abstractSchemaName)
Retrieves the entity with the given abstract schema name, which can also be the entity class name.
Parameters:
abstractSchemaName - The abstract schema name, which can be different from the entity class name but by default, it's the same
Returns:
The managed type that has the given name or null if none could be found

getMapping

protected IMapping getMapping(Expression expression)
Returns the IMapping for the field represented by the given Expession.
Parameters:
expression - The Expression representing a state field path expression or a collection-valued path expression
Returns:
Either the IMapping or null if none exists

getProvider

protected IManagedTypeProvider getProvider()
Retrieves the provider of managed types.
Returns:
The object that has access to the application's managed types.

getQuery

protected IQuery getQuery()
Returns the external form of the JPQL query.
Returns:
The external form of the JPQL query

getQueryExpression

protected java.lang.String getQueryExpression()
Returns the string representation of the JPQL query.
Returns:
A non-null string representation of the JPQL query

getResolver

protected Resolver getResolver(Expression expression)
Creates or retrieved the cached Resolver for the given Expression. The Resolver can return the IType and ITypeDeclaration of the Expression and either the IManagedType or the IMapping.
Parameters:
expression - The Expression for which its Resolver will be retrieved
Returns:
Resolver for the given Expression

getType

protected IType getType(java.lang.Class<?> type)
Retrieves the external type for the given Java type.
Parameters:
type - The Java type to wrap with an external form
Returns:
The external form of the given type

getType

protected IType getType(Expression expression)
Returns the IType of the given Expression.
Parameters:
expression - The Expression for which its type will be calculated
Returns:
Either the IType that was resolved by this Resolver or the IType for IType.UNRESOLVABLE_TYPE if it could not be resolved

getType

protected IType getType(java.lang.String name)
Retrieves the external class for the given fully qualified class name.
Parameters:
typeName - The fully qualified class name of the class to retrieve
Returns:
The external form of the class to retrieve

getTypeDeclaration

protected ITypeDeclaration getTypeDeclaration(Expression expression)
Returns the ITypeDeclaration of the field handled by this Resolver.
Parameters:
expression - The Expression for which its type declaration will be calculated
Returns:
Either the ITypeDeclaration that was resolved by this Resolver or the ITypeDeclaration for IType.UNRESOLVABLE_TYPE if it could not be resolved

getTypeHelper

protected TypeHelper getTypeHelper()
Returns a helper that gives access to the most common types.
Returns:
A helper containing a collection of methods related to IType

getTypeRepository

protected ITypeRepository getTypeRepository()
Returns the type repository for the application.
Returns:
The repository of ITypes

initialize

protected void initialize()
Initializes this class.

isEclipseLinkPlatform

protected boolean isEclipseLinkPlatform()
Determines whether the platform is EclipseLink.
Returns:
true if the platform is EclipseLink; false if it's pure JPA (generic)

isEmbeddable

protected boolean isEmbeddable(IManagedType managedType)
Determines whether the given IManagedType is an IEmbeddable.
Parameters:
managedType - The IManagedType to check if it's an IEmbeddable
Returns:
true if the given IManagedType is an IEmbeddable; false otherwise

isEntity

protected boolean isEntity(IManagedType managedType)
Determines whether the given IManagedType is an IEntity.
Parameters:
managedType - The IManagedType to check if it's an IEntity
Returns:
true if the given IManagedType is an IEntity; false otherwise

isJavaPlatform

protected boolean isJavaPlatform()
Determines whether the platform is pure JPA (generic).
Returns:
true if the platform is pure JPA; false if it's EclipseLink

isMappedSuperclass

protected boolean isMappedSuperclass(IManagedType managedType)
Determines whether the given IManagedType is an IMappedSuperclass.
Parameters:
managedType - The IManagedType to check if it's an IMappedSuperclass
Returns:
true if the given IManagedType is an IMappedSuperclass; false otherwise

isNull

protected final boolean isNull(Expression expression)
Determines whether the given Expression is the NullExpression.
Parameters:
expression - The Expression to visit
Returns:
true if the given Expression is NullExpression; false otherwise

managedTypeVisitor

private AbstractVisitor.ManagedTypeVisitor managedTypeVisitor()

mappedSuperclass

protected IMappedSuperclass mappedSuperclass(IManagedType managedType)
Returns the given IManagedType if it is an IMappedSuperclass.
Parameters:
managedType - The IManagedType to check if it's an IMappedSuperclass
Returns:
The given IManagedType cast as IMappedSuperclass or null if it is not an IMappedSuperclass

nullExpressionVisitor

private AbstractVisitor.NullExpressionVisitor nullExpressionVisitor()

visit

protected abstract void visit(Expression expression)
Blindly visit the given Expression.
Overrides:
visit in class AnonymousExpressionVisitor
Parameters:
expression - The Expression to visit

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.