Class QueryBuilder
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.sql.QueryBuilder
-
- All Implemented Interfaces:
QueryTreeBuilder
public class QueryBuilder extends java.lang.Object implements QueryTreeBuilder
Implements the JCR SQL query tree builder.
-
-
Constructor Summary
Constructors Constructor Description QueryBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanHandle(java.lang.String language)Returnstrueif this query tree builder can handle a statement inlanguage.QueryRootNodecreateQueryTree(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory)Creates aQueryNodetree from a statement using the passed query node factory.java.lang.String[]getSupportedLanguages()This builder supportsQuery.SQL.java.lang.StringtoString(QueryRootNode root, NameResolver resolver)Creates a String representation of the query node tree in the syntax thisQueryTreeBuildercan handle.
-
-
-
Method Detail
-
createQueryTree
public QueryRootNode createQueryTree(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory) throws javax.jcr.query.InvalidQueryException
Creates aQueryNodetree from a statement using the passed query node factory.- Specified by:
createQueryTreein interfaceQueryTreeBuilder- Parameters:
statement- the statement.resolver- the name resolver to use.factory- the query node factory to use.- Returns:
- the
QueryNodetree for the statement. - Throws:
javax.jcr.query.InvalidQueryException- if the statement is malformed.
-
canHandle
public boolean canHandle(java.lang.String language)
Returnstrueif this query tree builder can handle a statement inlanguage.- Specified by:
canHandlein interfaceQueryTreeBuilder- Parameters:
language- the language of a query statement to build a query tree.- Returns:
trueif this builder can handlelanguage;falseotherwise.
-
getSupportedLanguages
public java.lang.String[] getSupportedLanguages()
This builder supportsQuery.SQL. Returns the set of query languages supported by this builder.- Specified by:
getSupportedLanguagesin interfaceQueryTreeBuilder- Returns:
- String array containing the names of the supported languages.
-
toString
public java.lang.String toString(QueryRootNode root, NameResolver resolver) throws javax.jcr.query.InvalidQueryException
Creates a String representation of the query node tree in the syntax thisQueryTreeBuildercan handle.- Specified by:
toStringin interfaceQueryTreeBuilder- Parameters:
root- the root of the query node tree.resolver- to resolve Names.- Returns:
- a String representation of the query node tree.
- Throws:
javax.jcr.query.InvalidQueryException- if the query node tree cannot be converted into a String representation due to restrictions in this syntax.
-
-