org.apache.jackrabbit.spi.commons.query.xpath
Class QueryBuilder

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.query.xpath.QueryBuilder
All Implemented Interfaces:
QueryTreeBuilder

public class QueryBuilder
extends Object
implements QueryTreeBuilder

Implements the XPath query tree builder.


Constructor Summary
QueryBuilder()
           
 
Method Summary
 boolean canHandle(String language)
          Returns true if this query tree builder can handle a statement in language.
 QueryRootNode createQueryTree(String statement, NameResolver resolver, QueryNodeFactory factory)
          Creates a QueryNode tree from a statement using the passed query node factory.
 String[] getSupportedLanguages()
          This builder supports Query.XPATH.
 String toString(QueryRootNode root, NameResolver resolver)
          Creates a String representation of the query node tree in the syntax this QueryTreeBuilder can handle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder

public QueryBuilder()
Method Detail

createQueryTree

public QueryRootNode createQueryTree(String statement,
                                     NameResolver resolver,
                                     QueryNodeFactory factory)
                              throws InvalidQueryException
Description copied from interface: QueryTreeBuilder
Creates a QueryNode tree from a statement using the passed query node factory.

Specified by:
createQueryTree in interface QueryTreeBuilder
Parameters:
statement - the statement.
resolver - the name resolver to use.
factory - the query node factory to use.
Returns:
the QueryNode tree for the statement.
Throws:
InvalidQueryException - if the statement is malformed.

canHandle

public boolean canHandle(String language)
Description copied from interface: QueryTreeBuilder
Returns true if this query tree builder can handle a statement in language.

Specified by:
canHandle in interface QueryTreeBuilder
Parameters:
language - the language of a query statement to build a query tree.
Returns:
true if this builder can handle language; false otherwise.

getSupportedLanguages

public String[] getSupportedLanguages()
This builder supports Query.XPATH.

Specified by:
getSupportedLanguages in interface QueryTreeBuilder
Returns:
String array containing the names of the supported languages.

toString

public String toString(QueryRootNode root,
                       NameResolver resolver)
                throws InvalidQueryException
Description copied from interface: QueryTreeBuilder
Creates a String representation of the query node tree in the syntax this QueryTreeBuilder can handle.

Specified by:
toString in interface QueryTreeBuilder
Parameters:
root - the root of the query node tree.
resolver - to resolve Names.
Returns:
a String representation of the query node tree.
Throws:
InvalidQueryException - if the query node tree cannot be converted into a String representation due to restrictions in this syntax.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.