Class XPathQueryBuilder
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.xpath.XPathQueryBuilder
-
- All Implemented Interfaces:
XPathTreeConstants
,XPathVisitor
public class XPathQueryBuilder extends java.lang.Object implements XPathVisitor, XPathTreeConstants
Query builder that translates a XPath statement into a query tree structure.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.spi.commons.query.xpath.XPathTreeConstants
JJTADDITIVEEXPR, JJTANDEXPR, JJTANYKINDTEST, JJTANYNAME, JJTAPOSATTRCONTENTCHAR, JJTAPOSATTRVALUECONTENT, JJTAS, JJTASCENDING, JJTASSIGNEQUALS, JJTAT, JJTATOMICTYPE, JJTATSTRINGLITERAL, JJTATTRIBNAMEORWILDCARD, JJTATTRIBUTEDECLARATION, JJTATTRIBUTELBRACE, JJTATTRIBUTENAME, JJTATTRIBUTEQNAMELBRACE, JJTATTRIBUTETEST, JJTATTRIBUTETYPE, JJTATTRIBUTETYPEFORKINDTEST, JJTATWORD, JJTAXISANCESTOR, JJTAXISANCESTORORSELF, JJTAXISATTRIBUTE, JJTAXISCHILD, JJTAXISDESCENDANT, JJTAXISDESCENDANTORSELF, JJTAXISFOLLOWING, JJTAXISFOLLOWINGSIBLING, JJTAXISPARENT, JJTAXISPRECEDING, JJTAXISPRECEDINGSIBLING, JJTAXISSELF, JJTBASEURIDECL, JJTCASE, JJTCASECLAUSE, JJTCASTABLEEXPR, JJTCASTAS, JJTCASTEXPR, JJTCDATASECTION, JJTCDATASECTIONCHAR, JJTCDATASECTIONCONTENTS, JJTCDATASECTIONEND, JJTCDATASECTIONSTART, JJTCDATASECTIONSTARTFORELEMENTCONTENT, JJTCHARREF, JJTCLOSEAPOS, JJTCLOSEQUOT, JJTCOLLATION, JJTCOLONEQUALS, JJTCOMMAFORKINDTEST, JJTCOMMENTCONTENTCHAR, JJTCOMMENTCONTENTCHARDASH, JJTCOMMENTLBRACE, JJTCOMMENTLPARFORKINDTEST, JJTCOMMENTTEST, JJTCOMMONCONTENT, JJTCOMPARISONEXPR, JJTCOMPATTRCONSTRUCTOR, JJTCOMPCOMMENTCONSTRUCTOR, JJTCOMPDOCCONSTRUCTOR, JJTCOMPELEMCONSTRUCTOR, JJTCOMPPICONSTRUCTOR, JJTCOMPTEXTCONSTRUCTOR, JJTCOMPUTEDCONSTRUCTOR, JJTCONSTRUCTIONDECL, JJTCONSTRUCTOR, JJTCONTENTEXPR, JJTDECIMALLITERAL, JJTDECLAREBASEURI, JJTDECLARECOLLATION, JJTDECLARECONSTRUCTION, JJTDECLAREDEFAULTELEMENT, JJTDECLAREDEFAULTFUNCTION, JJTDECLAREDEFAULTORDERINGEMPTY, JJTDECLAREINHERITNAMESPACES, JJTDECLARENAMESPACE, JJTDECLAREORDERING, JJTDECLAREXMLSPACE, JJTDEFAULT, JJTDEFAULTCOLLATIONDECL, JJTDEFAULTELEMENT, JJTDEFAULTNAMESPACEDECL, JJTDEFINEFUNCTION, JJTDEFINEVARIABLE, JJTDESCENDING, JJTDIRATTRIBUTELIST, JJTDIRATTRIBUTEVALUE, JJTDIRCOMMENTCONSTRUCTOR, JJTDIRCOMMENTCONTENTS, JJTDIRECTCONSTRUCTOR, JJTDIRELEMCONSTRUCTOR, JJTDIRELEMCONTENT, JJTDIRPICONSTRUCTOR, JJTDIRPICONTENTS, JJTDOCUMENTLBRACE, JJTDOCUMENTLPAR, JJTDOCUMENTLPARFORKINDTEST, JJTDOCUMENTTEST, JJTDOT, JJTDOTDOT, JJTDOUBLELITERAL, JJTELEMENTCONTENTCHAR, JJTELEMENTDECLARATION, JJTELEMENTLBRACE, JJTELEMENTNAME, JJTELEMENTNAMEORWILDCARD, JJTELEMENTQNAMELBRACE, JJTELEMENTTEST, JJTELEMENTTYPE, JJTELEMENTTYPEFORDOCUMENTTEST, JJTELEMENTTYPEFORKINDTEST, JJTEMPTYGREATEST, JJTEMPTYLEAST, JJTEMPTYORDERINGDECL, JJTEMPTYTAGCLOSE, JJTEMPTYTOK, JJTENCLOSEDEXPR, JJTENDTAGCLOSE, JJTENDTAGOPEN, JJTESCAPEAPOS, JJTESCAPEQUOT, JJTEVERY, JJTEXPR, JJTEXTERNAL, JJTFLWOREXPR, JJTFUNCTIONCALL, JJTFUNCTIONDECL, JJTIFEXPR, JJTIMPORT, JJTIMPORTMODULETOKEN, JJTIMPORTSCHEMATOKEN, JJTIN, JJTINHERITNAMESPACESDECL, JJTINSTANCEOFEXPR, JJTINTEGERLITERAL, JJTINTERSECTEXCEPTEXPR, JJTITEM, JJTLBRACE, JJTLBRACEEXPRENCLOSURE, JJTLCURLYBRACEESCAPE, JJTLETCLAUSE, JJTLETVARIABLE, JJTLIBRARYMODULE, JJTMAINMODULE, JJTMODULE, JJTMODULEDECL, JJTMODULEIMPORT, JJTMODULENAMESPACE, JJTMULTIPLICATIVEEXPR, JJTNAMESPACE, JJTNAMESPACEDECL, JJTNAMETEST, JJTNCNAMECOLONSTAR, JJTNCNAMEFORPI, JJTNCNAMEFORPREFIX, JJTNILLABLE, JJTNO, JJTNODELPARFORKINDTEST, jjtNodeName, JJTNODETEST, JJTOCCURRENCEONEORMORE, JJTOCCURRENCEZEROORMORE, JJTOCCURRENCEZEROORONE, JJTOPENAPOS, JJTOPENQUOT, JJTORDERBY, JJTORDERBYCLAUSE, JJTORDERBYSTABLE, JJTORDERED, JJTORDEREDOPEN, JJTORDERINGMODEDECL, JJTORDERMODIFIER, JJTORDERSPEC, JJTORDERSPECLIST, JJTOREXPR, JJTPARAM, JJTPARAMLIST, JJTPATHEXPR, JJTPICONTENTCHAR, JJTPILBRACE, JJTPINCNAMELBRACE, JJTPITARGET, JJTPITEST, JJTPOSITIONALVAR, JJTPREDEFINEDENTITYREF, JJTPREDICATE, JJTPREDICATELIST, JJTPROCESSINGINSTRUCTIONEND, JJTPROCESSINGINSTRUCTIONLPARFORKINDTEST, JJTPROCESSINGINSTRUCTIONSTART, JJTPROCESSINGINSTRUCTIONSTARTFORELEMENTCONTENT, JJTPROLOG, JJTQNAME, JJTQNAMEFORATOMICTYPE, JJTQNAMEFORITEMTYPE, JJTQNAMEFORSEQUENCETYPE, JJTQNAMELPAR, JJTQUANTIFIEDEXPR, JJTQUERYBODY, JJTQUERYLIST, JJTQUOTATTRCONTENTCHAR, JJTQUOTATTRVALUECONTENT, JJTRANGEEXPR, JJTRBRACE, JJTRCURLYBRACEESCAPE, JJTROOT, JJTROOTDESCENDANTS, JJTS, JJTSATISFIES, JJTSCHEMAATTRIBUTETEST, JJTSCHEMAATTRIBUTETYPE, JJTSCHEMAATTRIBUTETYPEFORKINDTEST, JJTSCHEMAELEMENTTEST, JJTSCHEMAELEMENTTYPE, JJTSCHEMAELEMENTTYPEFORDOCUMENTTEST, JJTSCHEMAELEMENTTYPEFORKINDTEST, JJTSCHEMAIMPORT, JJTSCHEMAMODEFORDECLARECONSTRUCTION, JJTSCHEMAPREFIX, JJTSEPARATOR, JJTSEQUENCETYPE, JJTSETTER, JJTSFORPI, JJTSINGLETYPE, JJTSLASHSLASH, JJTSOME, JJTSTAR, JJTSTARCOLONNCNAME, JJTSTARTTAGCLOSE, JJTSTARTTAGOPEN, JJTSTARTTAGOPENROOT, JJTSTEPEXPR, JJTSTRINGLITERAL, JJTSTRINGLITERALFORKINDTEST, JJTSTRINGLITERALFORVERSION, JJTTAGQNAME, JJTTEXTLBRACE, JJTTEXTLPARFORKINDTEST, JJTTEXTTEST, JJTTREATEXPR, JJTTYPEDECLARATION, JJTTYPENAME, JJTTYPESWITCHEXPR, JJTUNARYEXPR, JJTUNARYMINUS, JJTUNARYPLUS, JJTUNIONEXPR, JJTUNORDERED, JJTUNORDEREDOPEN, JJTURLLITERAL, JJTVALIDATEEXPR, JJTVALIDATELBRACE, JJTVALIDATESCHEMAMODE, JJTVALUEINDICATOR, JJTVARDECL, JJTVARNAME, JJTVERSIONDECL, JJTVOID, JJTWHERE, JJTWHERECLAUSE, JJTXMLCOMMENTEND, JJTXMLCOMMENTSTART, JJTXMLCOMMENTSTARTFORELEMENTCONTENT, JJTXMLSPACEDECL, JJTXMLSPACEPRESERVE, JJTXMLSPACESTRIP, JJTXPATH2, JJTXQUERYENCODING, JJTXQUERYVERSION, JJTYES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QueryRootNode
createQuery(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory)
Creates aQueryNode
tree from a XPath statement using the passed query nodefactory
.static java.lang.String
toString(QueryRootNode root, NameResolver resolver)
Creates a String representation of the query node tree in XPath syntax.java.lang.Object
visit(SimpleNode node, java.lang.Object data)
Implements the generic visit method for thisXPathVisitor
.
-
-
-
Method Detail
-
createQuery
public static QueryRootNode createQuery(java.lang.String statement, NameResolver resolver, QueryNodeFactory factory) throws InvalidQueryException
Creates aQueryNode
tree from a XPath statement using the passed query nodefactory
.- Parameters:
statement
- the XPath statement.resolver
- the name resolver to use.factory
- the query node factory.- Returns:
- the
QueryNode
tree for the XPath statement. - Throws:
InvalidQueryException
- if the XPath statement is malformed.
-
toString
public static java.lang.String toString(QueryRootNode root, NameResolver resolver) throws InvalidQueryException
Creates a String representation of the query node tree in XPath syntax.- Parameters:
root
- the root of the query node tree.resolver
- to resolveName
s.- 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 XPath.
-
visit
public java.lang.Object visit(SimpleNode node, java.lang.Object data)
Implements the generic visit method for thisXPathVisitor
.- Specified by:
visit
in interfaceXPathVisitor
- Parameters:
node
- the current node as created by the XPath parser.data
- the currentQueryNode
created by thisXPathVisitor
.- Returns:
- the current
QueryNode
. Can be different fromdata
.
-
-