@Override public Expression get() { return target.getPath(); }
@Override public Expression visit(ListIndexExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new ListIndexExpression((PathExpression) newExpression); } return expression; }
@Override public ListIndexExpression clone(boolean resolved) { return new ListIndexExpression((PathExpression) path.clone(resolved)); }
@Override public void set(Expression expression) { target.setPath((PathExpression) expression); }
@Override public ListIndexExpression clone(boolean resolved) { return new ListIndexExpression((PathExpression) path.clone(resolved)); }
@Override public void set(Expression expression) { target.setPath((PathExpression) expression); }
@Override public Expression get() { return target.getPath(); }
@Override public Expression visit(ListIndexExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new ListIndexExpression((PathExpression) newExpression); } return expression; }
@Override public Expression visitIndexFunction(IndexFunctionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); return new ListIndexExpression(collectionPath); }
@Override public Expression visitIndexFunction(IndexFunctionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); return new ListIndexExpression(collectionPath); }
@Override public Expression createExpression(String field) { List<PathElementExpression> pathElements = new ArrayList<>(); if (qualificationExpression != null) { List<PathElementExpression> pathElementExpressions = new ArrayList<>(1); pathElementExpressions.add(new PropertyExpression(parent.getAlias())); PathExpression path = new PathExpression(pathElementExpressions); if ("KEY".equalsIgnoreCase(qualificationExpression)) { pathElements.add(new MapKeyExpression(path)); } else if ("INDEX".equalsIgnoreCase(qualificationExpression)) { pathElements.add(new ListIndexExpression(path)); } else if ("ENTRY".equalsIgnoreCase(qualificationExpression)) { pathElements.add(new MapEntryExpression(path)); } } else { pathElements.add(new PropertyExpression(aliasInfo.getAlias())); } if (field != null) { for (String fieldPart : field.split("\\.")) { pathElements.add(new PropertyExpression(fieldPart)); } } if (valuesTypeName != null) { return new FunctionExpression("FUNCTION", Arrays.asList( new StringLiteral("TREAT_" + valuesTypeName.toUpperCase()), new PathExpression(pathElements) )); } else { return new PathExpression(pathElements); } }
private EqPredicate getArrayExpressionPredicate(JoinNode joinNode, ArrayExpression arrayExpr) { PathExpression keyPath = new PathExpression(new ArrayList<PathElementExpression>(), true); keyPath.getExpressions().add(new PropertyExpression(joinNode.getAliasInfo().getAlias())); keyPath.setPathReference(new SimplePathReference(joinNode, null, joinNode.getNodeType())); Attribute<?, ?> arrayBaseAttribute = joinNode.getParentTreeNode().getAttribute(); Expression keyExpression; if (arrayBaseAttribute instanceof ListAttribute<?, ?>) { keyExpression = new ListIndexExpression(keyPath); } else { keyExpression = new MapKeyExpression(keyPath); } return new EqPredicate(keyExpression, arrayExpr.getIndex()); }