private static String renderQueryIfExpressionOrReturnQuery(String query, EntityMetadata<?> metadata,
                                                               SpelExpressionParser parser) {

        Assert.notNull(query, "query must not be null!");
        Assert.notNull(metadata, "metadata must not be null!");
        Assert.notNull(parser, "parser must not be null!");

        if (!containsExpression(query)) {
            return query;
        }

        StandardEvaluationContext evalContext = new StandardEvaluationContext();
        evalContext.setVariable(ENTITY_NAME, metadata.getJavaType().getName());

        query = potentiallyQuoteExpressionsParameter(query);

        Expression expr = parser.parseExpression(query, ParserContext.TEMPLATE_EXPRESSION);

        String result = expr.getValue(evalContext, String.class);

        if (result == null) {
            return query;
        }

        return potentiallyUnquoteParameterExpressions(result);
    }
private static String renderQueryIfExpressionOrReturnQuery ( String query , EntityMetadata < ? > metadata , SpelExpressionParser parser ) { Assert . notNull ( query , "query must not be null!" ) ; Assert . notNull ( metadata , "metadata must not be null!" ) ; Assert . notNull ( parser , "parser must not be null!" ) ; if ( ! containsExpression ( query ) ) { return query ; } StandardEvaluationContext evalContext = new StandardEvaluationContext ( ) ; evalContext . setVariable ( ENTITY_NAME , metadata . getJavaType ( ) . getName ( ) ) ; query = potentiallyQuoteExpressionsParameter ( query ) ; Expression expr = parser . parseExpression ( query , ParserContext . TEMPLATE_EXPRESSION ) ; String result = expr . getValue ( evalContext , String . class ) ; if ( result == null ) { return query ; } return potentiallyUnquoteParameterExpressions ( result ) ; }
@param query,   the query expression potentially containing a SpEL expression. Must not be {@literal null}.}
@param metadata the {@link EntityMetadata} for the given entity. Must not be {@literal null}.
@param parser   Must not be {@literal null}.
@return