Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.xpath
Class XPathToQueryTranslator

    java.lang.Object
      org.modeshape.jcr.xpath.XPathToQueryTranslator

    public class XPathToQueryTranslator

extends Object

A component that translates an `XPath` abstract syntax model representation into a `ModeShape abstract query model`.

Nested Class Summary
`protected static class` | `XPathToQueryTranslator.DepthMode`
`protected static class` | `XPathToQueryTranslator.DualPathLikeBuilder`
`protected static interface` | `XPathToQueryTranslator.PathLikeBuilder`
`protected static class` | `XPathToQueryTranslator.RelativePathLikeExpressions`
`protected static class` | `XPathToQueryTranslator.SinglePathLikeBuilder`

Field Summary
`protected static Map<XPath.NameTest,String>` | `CAST_FUNCTION_NAME_TO_TYPE`

Constructor Summary
`XPathToQueryTranslator(TypeSystem context, String query)`

Method Summary
`protected boolean` | `appliesToPathConstraint(List<XPath.Component> predicates)` Determine if the predicates contain any expressions that cannot be put into a LIKE constraint on the path.
`QueryCommand` | `createQuery(XPath.Component xpath)`
`protected List<XPath.AttributeNameTest>` | `extractAttributeNames(XPath.BinaryComponent binary)` Find any `attribute names` that have been unioned together (with '|').
`protected List<XPath.NameTest>` | `extractElementNames(XPath.BinaryComponent binary)` Find any `element names` that have been unioned together (with '|').
`protected String` | `nameFrom(XPath.NameTest name)`
`protected String` | `newAlias()`
`protected XPathToQueryTranslator.RelativePathLikeExpressions` | `relativePathLikeExpressions(XPath.PathExpression pathExpression)`
`protected void` | `translate(XPath.PathExpression pathExpression)`
`protected String` | `translateElementTest(XPath.ElementTest elementTest, List<XPath.StepExpression> pathConstraint, QueryBuilder.ConstraintBuilder where)`
`protected boolean` | `translatePathExpressionConstraint(XPath.PathExpression pathExrp, QueryBuilder.ConstraintBuilder where, String tableName)`
`protected String` | `translatePredicate(XPath.Component predicate, String tableName, QueryBuilder.ConstraintBuilder where)`
`protected void` | `translatePredicates(List<XPath.Component> predicates, String tableName, QueryBuilder.ConstraintBuilder where)`
`protected String` | `translateSource(String tableName, List<XPath.StepExpression> path, QueryBuilder.ConstraintBuilder where)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CAST_FUNCTION_NAME_TO_TYPE

    protected static final Map<XPath.NameTest,String> CAST_FUNCTION_NAME_TO_TYPE

Constructor Detail

### XPathToQueryTranslator

    public XPathToQueryTranslator(TypeSystem context,
                                  String query)

Method Detail

### createQuery

    public QueryCommand createQuery(XPath.Component xpath)

### translate

    protected void translate(XPath.PathExpression pathExpression)

### extractAttributeNames

    protected List<XPath.AttributeNameTest> extractAttributeNames(XPath.BinaryComponent binary)

  Find any `attribute names` that have been unioned together (with '|'). Any other combination of objects results in an error.

  Parameters:
    `binary` - the binary component
  Returns:
    the list of attribute names, if that's all that's in the supplied component; may be empty

### extractElementNames

    protected List<XPath.NameTest> extractElementNames(XPath.BinaryComponent binary)

  Find any `element names` that have been unioned together (with '|'). Any other combination of objects results in an error.

  Parameters:
    `binary` - the binary component
  Returns:
    the list of attribute names, if that's all that's in the supplied component; may be empty

### translateSource

    protected String translateSource(String tableName,
                                     List<XPath.StepExpression> path,
                                     QueryBuilder.ConstraintBuilder where)

### translateElementTest

    protected String translateElementTest(XPath.ElementTest elementTest,
                                          List<XPath.StepExpression> pathConstraint,
                                          QueryBuilder.ConstraintBuilder where)

### translatePredicates

    protected void translatePredicates(List<XPath.Component> predicates,
                                       String tableName,
                                       QueryBuilder.ConstraintBuilder where)

### translatePredicate

    protected String translatePredicate(XPath.Component predicate,
                                        String tableName,
                                        QueryBuilder.ConstraintBuilder where)

### appliesToPathConstraint

    protected boolean appliesToPathConstraint(List<XPath.Component> predicates)

  Determine if the predicates contain any expressions that cannot be put into a LIKE constraint on the path.

  Parameters:
    `predicates` - the predicates
  Returns:
    true if the supplied predicates can be handled entirely in the LIKE constraint on the path, or false if they have to be handled as other criteria

### translatePathExpressionConstraint

    protected boolean translatePathExpressionConstraint(XPath.PathExpression pathExrp,
                                                        QueryBuilder.ConstraintBuilder where,
                                                        String tableName)

### relativePathLikeExpressions

    protected XPathToQueryTranslator.RelativePathLikeExpressions relativePathLikeExpressions(XPath.PathExpression pathExpression)

### nameFrom

    protected String nameFrom(XPath.NameTest name)

### newAlias

    protected String newAlias()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.