Class JPQLParser

  • Direct Known Subclasses:
    JPQLParser

    public abstract class JPQLParser
    extends org.eclipse.persistence.internal.libraries.antlr.runtime.Parser
    EJBQLParser is the superclass of the ANTLR generated parser.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected NodeFactory factory
      The factory to create parse tree nodes.
      • Fields inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.Parser

        input
      • Fields inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer

        DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected JPQLParser​(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream stream)  
        JPQLParser​(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream input, org.eclipse.persistence.internal.libraries.antlr.runtime.RecognizerSharedState state)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addError​(java.lang.Exception e)
      INTERNAL Add the exception to the list of errors.
      static java.lang.String ANTLRVersion()
      INTERNAL Returns the ANTLR version currently used.
      static JPQLParser buildParserFor​(java.lang.String queryText)
      INTERNAL Creates a parser for the specified query string.
      static JPQLParser buildParserFor​(java.lang.String queryName, java.lang.String queryText)
      INTERNAL Creates a parser for the specified query string.
      static JPQLParseTree buildParseTree​(java.lang.String queryText)
      INTERNAL Builds a parser, parses the specified query string and returns the parse tree.
      static JPQLParseTree buildParseTree​(java.lang.String queryName, java.lang.String queryText)
      INTERNAL Builds a parser, parses the specified query string and returns the parse tree.
      abstract void document()
      This is the parser start method.
      protected JPQLException generateException()
      INTERNAL Generate an exception which encapsulates all the exceptions generated by this parser.
      java.util.List getErrors()
      INTERNAL Returns the list of errors found during the parsing process.
      NodeFactory getNodeFactory()
      INTERNAL Returns the factory used by the parser to create a parse tree and parse tree nodes.
      JPQLParseTree getParseTree()
      INTERNAL Returns the parse tree created by a successful run of the parse method.
      java.lang.String getQueryInfo()
      INTERNAL Return the the query text prefixed by the query name in case of a named query.
      java.lang.String getQueryName()
      INTERNAL Return the name of the current query being compiled.
      java.lang.String getQueryText()
      INTERNAL Return the text of the current query being compiled.
      abstract java.lang.Object getRootNode()
      Returns the root node after representing the parse tree for the current query string.
      protected JPQLException handleRecognitionException​(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
      INTERNAL Map an exception thrown by the ANTLR generated code to an JPQLException.
      boolean hasErrors()
      INTERNAL Returns true if there were errors during the parsing process.
      JPQLParseTree parse()
      INTERNAL Parse the query string that was specified on parser creation.
      void reportError​(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
      Method called by the ANTLR generated code in case of an error.
      void setNodeFactory​(NodeFactory factory)
      INTERNAL Set the factory used by the parser to create a parse tree and parse tree nodes.
      void setQueryName​(java.lang.String queryName)
      INTERNAL Set the name of the current query being compiled.
      void setQueryText​(java.lang.String queryText)
      INTERNAL Set the text of the current query being compiled.
      • Methods inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.Parser

        getCurrentInputSymbol, getMissingSymbol, getSourceName, getTokenStream, reset, setTokenStream, traceIn, traceOut
      • Methods inherited from class org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer

        alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getErrorHeader, getErrorMessage, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, matchAny, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, recoverFromMismatchedToken, setBacktrackingLevel, toStrings, traceIn, traceOut
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • factory

        protected NodeFactory factory
        The factory to create parse tree nodes.
    • Constructor Detail

      • JPQLParser

        protected JPQLParser​(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream stream)
      • JPQLParser

        public JPQLParser​(org.eclipse.persistence.internal.libraries.antlr.runtime.TokenStream input,
                          org.eclipse.persistence.internal.libraries.antlr.runtime.RecognizerSharedState state)
    • Method Detail

      • ANTLRVersion

        public static java.lang.String ANTLRVersion()
                                             throws java.lang.Exception
        INTERNAL Returns the ANTLR version currently used.
        Throws:
        java.lang.Exception
      • buildParseTree

        public static JPQLParseTree buildParseTree​(java.lang.String queryText)
                                            throws JPQLException
        INTERNAL Builds a parser, parses the specified query string and returns the parse tree. Any error in the query text results in an JPQLException. This method is used for dynamic queries.
        Throws:
        JPQLException
      • buildParseTree

        public static JPQLParseTree buildParseTree​(java.lang.String queryName,
                                                   java.lang.String queryText)
                                            throws JPQLException
        INTERNAL Builds a parser, parses the specified query string and returns the parse tree. Any error in the query text results in an JPQLException.
        Throws:
        JPQLException
      • buildParserFor

        public static JPQLParser buildParserFor​(java.lang.String queryText)
                                         throws JPQLException
        INTERNAL Creates a parser for the specified query string. The query string is not parsed (see method parse). This method is used for dynamic queries.
        Throws:
        JPQLException
      • buildParserFor

        public static JPQLParser buildParserFor​(java.lang.String queryName,
                                                java.lang.String queryText)
                                         throws JPQLException
        INTERNAL Creates a parser for the specified query string. The query string is not parsed (see method parse).
        Throws:
        JPQLException
      • getParseTree

        public JPQLParseTree getParseTree()
        INTERNAL Returns the parse tree created by a successful run of the parse method.
      • getQueryText

        public java.lang.String getQueryText()
        INTERNAL Return the text of the current query being compiled.
      • setQueryText

        public void setQueryText​(java.lang.String queryText)
        INTERNAL Set the text of the current query being compiled. Please note, setting the query text using this method is for error handling and debugging purposes.
      • getQueryName

        public java.lang.String getQueryName()
        INTERNAL Return the name of the current query being compiled. This method returns null if the current query is a dynamic query and not a named query.
      • setQueryName

        public void setQueryName​(java.lang.String queryName)
        INTERNAL Set the name of the current query being compiled. Please note, setting the query name using this method is for error handling and debugging purposes.
      • getQueryInfo

        public java.lang.String getQueryInfo()
        INTERNAL Return the the query text prefixed by the query name in case of a named query. The method returns just the query text in case of a dynamic query.
      • setNodeFactory

        public void setNodeFactory​(NodeFactory factory)
        INTERNAL Set the factory used by the parser to create a parse tree and parse tree nodes.
      • getNodeFactory

        public NodeFactory getNodeFactory()
        INTERNAL Returns the factory used by the parser to create a parse tree and parse tree nodes.
      • getErrors

        public java.util.List getErrors()
        INTERNAL Returns the list of errors found during the parsing process.
      • hasErrors

        public boolean hasErrors()
        INTERNAL Returns true if there were errors during the parsing process.
      • addError

        public void addError​(java.lang.Exception e)
        INTERNAL Add the exception to the list of errors.
      • generateException

        protected JPQLException generateException()
        INTERNAL Generate an exception which encapsulates all the exceptions generated by this parser. Special case where the first exception is an JPQLException.
      • handleRecognitionException

        protected JPQLException handleRecognitionException​(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
        INTERNAL Map an exception thrown by the ANTLR generated code to an JPQLException.
      • reportError

        public void reportError​(org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException ex)
        Method called by the ANTLR generated code in case of an error.
        Overrides:
        reportError in class org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer
      • document

        public abstract void document()
                               throws org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException
        This is the parser start method. It will be implemented by the ANTLR generated subclass.
        Throws:
        org.eclipse.persistence.internal.libraries.antlr.runtime.RecognitionException
      • getRootNode

        public abstract java.lang.Object getRootNode()
        Returns the root node after representing the parse tree for the current query string. It will be implemented by the ANTLR generated subclass.