@Override public Expression clone(boolean resolved) { return new NumericLiteral(value, getNumericType()); }
@Override public void visit(NumericLiteral expression) { sb.append(expression.getValue()); }
@Override public Expression visitArrayExpressionIntegerLiteralIndex(ArrayExpressionIntegerLiteralIndexContext ctx) { return new ArrayExpression((PropertyExpression) ctx.simple_path_element().accept(this), new NumericLiteral(ctx.Integer_literal().getText(), NumericType.INTEGER)); }
@Override public void visit(NumericLiteral expression) { if (expression.getNumericType() != null) { currentPosition.setCurrentType(metamodel.type(expression.getNumericType().getJavaType())); } }
@Override public Expression visitArrayExpressionIntegerLiteralIndex(ArrayExpressionIntegerLiteralIndexContext ctx) { return new ArrayExpression((PropertyExpression) ctx.simple_path_element().accept(this), new NumericLiteral(ctx.Integer_literal().getText(), NumericType.INTEGER)); }
@Override public Expression clone(boolean resolved) { return new NumericLiteral(value, getNumericType()); }
if (operationBuilder.maxResults != Integer.MAX_VALUE) { setOperationArgs.add(new StringLiteral("LIMIT")); setOperationArgs.add(new NumericLiteral(Integer.toString(operationBuilder.maxResults), NumericType.INTEGER)); setOperationArgs.add(new NumericLiteral(Integer.toString(operationBuilder.firstResult), NumericType.INTEGER)); throw new IllegalArgumentException("First result without max results is not supported!"); } else { arguments.add(new NumericLiteral(Integer.toString(queryBuilder.getMaxResults()), NumericType.INTEGER)); arguments.add(new NumericLiteral(Integer.toString(queryBuilder.getFirstResult()), NumericType.INTEGER));
@Override public void visit(NumericLiteral expression) { sb.append(expression.getValue()); }
@Override public Expression visitNumeric_literal(JPQLSelectExpressionParser.Numeric_literalContext ctx) { NumericType numericType; String value; if (ctx.BigInteger_literal() != null) { numericType = NumericType.BIG_INTEGER; value = ctx.BigInteger_literal().getText(); } else if (ctx.Integer_literal() != null) { numericType = NumericType.INTEGER; value = ctx.Integer_literal().getText(); } else if (ctx.Long_literal() != null) { numericType = NumericType.LONG; value = ctx.Long_literal().getText(); } else if (ctx.Float_literal() != null) { numericType = NumericType.FLOAT; value = ctx.Float_literal().getText(); } else if (ctx.Double_literal() != null) { numericType = NumericType.DOUBLE; value = ctx.Double_literal().getText(); } else if (ctx.BigDecimal_literal() != null) { numericType = NumericType.BIG_DECIMAL; value = ctx.BigDecimal_literal().getText(); } else { throw new IllegalStateException("Could not find literal in context [" + ctx.getText() + "]"); } return new NumericLiteral(value, numericType); }
private String getJoinAlias(ArrayExpression expr) { StringBuilder sb = new StringBuilder(expr.getBase().toString()); Expression indexExpr = expr.getIndex(); if (indexExpr instanceof ParameterExpression) { ParameterExpression indexParamExpr = (ParameterExpression) indexExpr; sb.append('_'); sb.append(indexParamExpr.getName()); } else if (indexExpr instanceof PathExpression) { PathExpression indexPathExpr = (PathExpression) indexExpr; sb.append('_'); sb.append(((JoinNode) indexPathExpr.getBaseNode()).getAliasInfo().getAlias()); if (indexPathExpr.getField() != null) { sb.append('_'); sb.append(indexPathExpr.getField().replaceAll("\\.", "_")); } } else if (indexExpr instanceof NumericLiteral) { sb.append('_'); sb.append(((NumericLiteral) indexExpr).getValue()); } else if (indexExpr instanceof StringLiteral) { sb.append('_'); sb.append(((StringLiteral) indexExpr).getValue()); } else { throw new IllegalStateException("Invalid array index expression " + indexExpr.toString()); } return sb.toString(); }
@Override public Expression visitNumeric_literal(JPQLSelectExpressionParser.Numeric_literalContext ctx) { NumericType numericType; String value; if (ctx.BigInteger_literal() != null) { numericType = NumericType.BIG_INTEGER; value = ctx.BigInteger_literal().getText(); } else if (ctx.Integer_literal() != null) { numericType = NumericType.INTEGER; value = ctx.Integer_literal().getText(); } else if (ctx.Long_literal() != null) { numericType = NumericType.LONG; value = ctx.Long_literal().getText(); } else if (ctx.Float_literal() != null) { numericType = NumericType.FLOAT; value = ctx.Float_literal().getText(); } else if (ctx.Double_literal() != null) { numericType = NumericType.DOUBLE; value = ctx.Double_literal().getText(); } else if (ctx.BigDecimal_literal() != null) { numericType = NumericType.BIG_DECIMAL; value = ctx.BigDecimal_literal().getText(); } else { throw new IllegalStateException("Could not find literal in context [" + ctx.getText() + "]"); } return new NumericLiteral(value, numericType); }