@Override public Expression get() { return target.getPath(); }
@Override public Expression visit(MapKeyExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new MapKeyExpression((PathExpression) newExpression); } return expression; }
@Override public MapKeyExpression clone(boolean resolved) { return new MapKeyExpression((PathExpression) path.clone(resolved)); }
@Override public void set(Expression expression) { target.setPath((PathExpression) expression); }
@Override public MapKeyExpression clone(boolean resolved) { return new MapKeyExpression((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(MapKeyExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new MapKeyExpression((PathExpression) newExpression); } return expression; }
@Override public Expression visitKey_value_expression(JPQLSelectExpressionParser.Key_value_expressionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); if ("VALUE".equalsIgnoreCase(ctx.name.getText())) { return new MapValueExpression(collectionPath); } else { return new MapKeyExpression(collectionPath); } }
@Override public Expression visitKey_value_expression(JPQLSelectExpressionParser.Key_value_expressionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); if ("VALUE".equalsIgnoreCase(ctx.name.getText())) { return new MapValueExpression(collectionPath); } else { return new MapKeyExpression(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()); }