Class DefaultContentAssistVisitor

All Implemented Interfaces:
ExpressionVisitor

public class DefaultContentAssistVisitor extends AbstractContentAssistVisitor
This visitor traverses the JPQL parsed tree and gathers the possible proposals at a given position.

Example:

 // Have the external form of an IQuery
 IQuery query = ...

 // Create a JPQLQueryContext
 JPQLQueryContext context = new JPQLQueryContext();
 context.setQuery(query);

 // Create a map of the positions within the parsed tree
 QueryPosition queryPosition = context.getJPQLExpression().buildPosition(query.getExpression(), position);

 // Either a real extension that adds additional support or
 ContentAssistExtension extension = ContentAssistExtension.NULL_HELPER;

 // Create the visitor and visit the parsed tree
 DefaultContentAssistVisitor visitor = new DefaultContentAssistVisitor(context);
 visitor.buildProposals(queryPosition.getPosition(), extension);
 queryPosition.getExpression().accept(visitor);

 // Retrieve the proposals
 ContentAssistProposals proposals = visitor.getProposals();

 // Only required if the visitor is cached
 visitor.dispose();

 // Only required if the context is cached
 context.dispose();
 

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.

Since:
2.3
Version:
2.5.1