Example #1
0
  private final void end(QueryPart part) {
    if (visitParts != null) {
      for (VisitListener listener : visitListeners) listener.visitEnd(visitContext);

      if (visitParts.removeLast() != part)
        throw new RuntimeException("Mismatch between visited query parts");
    }
  }
Example #2
0
  private final QueryPart start(QueryPart part) {
    visitParts.addLast(part);

    for (VisitListener listener : visitListeners) {
      listener.visitStart(visitContext);
    }

    return visitParts.peekLast();
  }
Example #3
0
  @Override
  public final C start(Clause clause) {
    if (clause != null && visitClauses != null) {
      visitClauses.addLast(clause);

      for (VisitListener listener : visitListeners) listener.clauseStart(visitContext);
    }

    return (C) this;
  }
Example #4
0
  private final QueryPart start(QueryPart part) {
    if (visitParts != null) {
      visitParts.addLast(part);

      for (VisitListener listener : visitListeners) listener.visitStart(visitContext);

      return visitParts.peekLast();
    } else {
      return part;
    }
  }
Example #5
0
  @Override
  public final C end(Clause clause) {
    if (clause != null && visitClauses != null) {
      for (VisitListener listener : visitListeners) listener.clauseEnd(visitContext);

      if (visitClauses.removeLast() != clause)
        throw new IllegalStateException("Mismatch between visited clauses!");
    }

    return (C) this;
  }