Package org.eclipse.persistence.jpa.jpql.tools.resolver

Examples of org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver


  protected void visitPathExpression(AbstractPathExpression expression, Filter<IMapping> filter) {

    MappingCollector mappingCollector = getDefaultMappingCollector();
    int position = queryPosition.getPosition(expression);
    boolean mappingCollectorCreated = false;
    Resolver resolver = null;
    int length = 0;

    for (int index = 0, count = expression.pathSize(); index < count; index++) {
      String path = expression.getPath(index);

      // We're at the position, create the ChoiceBuilder
      if (position <= length + path.length()) {

        if (length == position) {
          path = ExpressionTools.EMPTY_STRING;
        }
        else if (position - length > -1) {
          path = path.substring(0, position - length);
        }

        // Special case where the path expression only has the
        // identification variable set
        if (resolver == null) {
          break;
        }

        mappingCollector = buildFilteringMappingCollector(expression, resolver, filter, path);
        mappingCollectorCreated = true;
        break;
      }
      // The path is entirely before the position of the cursor
      else {
        // The first path is always an identification variable
        if (resolver == null) {
          resolver = queryContext.getResolver(expression.getIdentificationVariable());
        }
        // Any other path is a property or collection-valued path
        else if ((index + 1 < count) || expression.endsWithDot()) {
          Resolver childResolver = resolver.getChild(path);
          if (childResolver == null) {
            childResolver = new StateFieldResolver(resolver, path);
            resolver.addChild(path, childResolver);
            resolver = childResolver;
          }
View Full Code Here


           expression.startsWithDot()) {

        return;
      }

      Resolver resolver = queryContext.getResolver(expression.getIdentificationVariable());

      // Can't continue to resolve the path expression
      if (resolver == null) {
        return;
      }

      // Now traverse the path expression after the identification variable
      for (int index = expression.hasVirtualIdentificationVariable() ? 0 : 1, count = expression.pathSize(); index < count; index++) {

        // Retrieve the mapping for the path at the current position
        String path = expression.getPath(index);
        Resolver childResolver = resolver.getChild(path);

        if (childResolver == null) {
          childResolver = new StateFieldResolver(resolver, path);
          resolver.addChild(path, childResolver);
        }

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.