org.hibernate.tool.ide.completion
Class HQLAnalyzer

java.lang.Object
  extended by org.hibernate.tool.ide.completion.HQLAnalyzer

public class HQLAnalyzer
extends Object

The HQLAnalyzer can answer certain questions about a HQL String.

Author:
leon, max.andersen@jboss.com

Nested Class Summary
static class HQLAnalyzer.SubQuery
           
 
Constructor Summary
HQLAnalyzer()
           
 
Method Summary
static String getEntityNamePrefix(char[] chars, int position)
          Returns reference name found from position and backwards in the array.
protected  SimpleHQLLexer getLexer(char[] chars)
           
protected  SimpleHQLLexer getLexer(char[] chars, int end)
           
protected  org.hibernate.tool.ide.completion.HQLAnalyzer.SubQueryList getSubQueries(char[] query, int position)
           
 List getVisibleEntityNames(char[] chars, int position)
           
 List getVisibleSubQueries(char[] chars, int position)
           
 boolean shouldShowEntityNames(char[] chars, int cursorPosition)
           
 boolean shouldShowEntityNames(String query, int cursorPosition)
          Returns true if the position is at a location where an entityname makes sense.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HQLAnalyzer

public HQLAnalyzer()
Method Detail

getLexer

protected SimpleHQLLexer getLexer(char[] chars,
                                  int end)

getLexer

protected SimpleHQLLexer getLexer(char[] chars)

shouldShowEntityNames

public boolean shouldShowEntityNames(String query,
                                     int cursorPosition)
Returns true if the position is at a location where an entityname makes sense. e.g. "from Pr| where x"

Parameters:
query -
cursorPosition -
Returns:

shouldShowEntityNames

public boolean shouldShowEntityNames(char[] chars,
                                     int cursorPosition)

getVisibleSubQueries

public List getVisibleSubQueries(char[] chars,
                                 int position)

getVisibleEntityNames

public List getVisibleEntityNames(char[] chars,
                                  int position)

getSubQueries

protected org.hibernate.tool.ide.completion.HQLAnalyzer.SubQueryList getSubQueries(char[] query,
                                                                                   int position)

getEntityNamePrefix

public static String getEntityNamePrefix(char[] chars,
                                         int position)
Returns reference name found from position and backwards in the array.