@Override public Expression get() { return target.getPath(); }
@Override public Expression visit(MapEntryExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new MapEntryExpression((PathExpression) newExpression); } return expression; }
@Override public MapEntryExpression clone(boolean resolved) { return new MapEntryExpression((PathExpression) path.clone(resolved)); }
@Override public void set(Expression expression) { target.setPath((PathExpression) expression); }
@Override public MapEntryExpression clone(boolean resolved) { return new MapEntryExpression((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(MapEntryExpression expression) { Expression newExpression = expression.getPath().accept(this); if (newExpression != expression.getPath()) { return new MapEntryExpression((PathExpression) newExpression); } return expression; }
@Override public Expression visitEntryFunction(JPQLSelectExpressionParser.EntryFunctionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); return new MapEntryExpression(collectionPath); }
@Override public Expression visitEntryFunction(JPQLSelectExpressionParser.EntryFunctionContext ctx) { PathExpression collectionPath = (PathExpression) ctx.collection_valued_path_expression().accept(this); collectionPath.setCollectionKeyPath(true); return new MapEntryExpression(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); } }
@Override public void visit(MapEntryExpression expression) { sb.append("ENTRY("); expression.getPath().accept(this); sb.append(')'); }