diff --git a/spring-expression/src/main/java/org/springframework/expression/ExpressionParser.java b/spring-expression/src/main/java/org/springframework/expression/ExpressionParser.java index c90dc073bd0..a8e93f8cf62 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ExpressionParser.java +++ b/spring-expression/src/main/java/org/springframework/expression/ExpressionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,8 @@ package org.springframework.expression; /** * Parses expression strings into compiled expressions that can be evaluated. - * Supports parsing templates as well as standard expression strings. + * + *

Supports parsing template expressions as well as standard expression strings. * * @author Keith Donald * @author Andy Clement @@ -27,29 +28,31 @@ package org.springframework.expression; public interface ExpressionParser { /** - * Parse the expression string and return an Expression object you can use for repeated evaluation. - *

Some examples: + * Parse the expression string and return an {@link Expression} object that + * can be used for repeated evaluation. + *

Examples: *

 	 *     3 + 4
 	 *     name.firstName
 	 * 
* @param expressionString the raw expression string to parse - * @return an evaluator for the parsed expression - * @throws ParseException an exception occurred during parsing + * @return an {@code Expression} for the parsed expression + * @throws ParseException if an exception occurred during parsing */ Expression parseExpression(String expressionString) throws ParseException; /** - * Parse the expression string and return an Expression object you can use for repeated evaluation. - *

Some examples: + * Parse the expression string and return an {@link Expression} object that + * can be used for repeated evaluation. + *

Examples: *

 	 *     3 + 4
 	 *     name.firstName
 	 * 
* @param expressionString the raw expression string to parse - * @param context a context for influencing this expression parsing routine (optional) - * @return an evaluator for the parsed expression - * @throws ParseException an exception occurred during parsing + * @param context a context for influencing the expression parsing routine + * @return an {@code Expression} for the parsed expression + * @throws ParseException if an exception occurred during parsing */ Expression parseExpression(String expressionString, ParserContext context) throws ParseException; diff --git a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java index d8504f1a19b..4d8fc5f4225 100644 --- a/spring-expression/src/main/java/org/springframework/expression/ParserContext.java +++ b/spring-expression/src/main/java/org/springframework/expression/ParserContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public interface ParserContext { String getExpressionPrefix(); /** - * For template expressions, return the prefix that identifies the end of an + * For template expressions, returns the prefix that identifies the end of an * expression block within a string. For example: "}" * @return the suffix that identifies the end of an expression */ @@ -55,8 +55,9 @@ public interface ParserContext { /** - * The default ParserContext implementation that enables template expression - * parsing mode. The expression prefix is "#{" and the expression suffix is "}". + * The default {@link ParserContext} implementation that enables template + * expression parsing. + *

The expression prefix is "#{", and the expression suffix is "}". * @see #isTemplate() */ ParserContext TEMPLATE_EXPRESSION = new ParserContext() { diff --git a/spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java b/spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java index f979a258fb4..bdf4ad1660d 100644 --- a/spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java +++ b/spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java @@ -29,8 +29,11 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** - * An expression parser that understands templates. It can be subclassed by expression - * parsers that do not offer first class support for templating. + * Abstract base class for {@linkplain ExpressionParser expression parsers} that + * support templates. + * + *

Can be subclassed by expression parsers that offer first class support for + * templating. * * @author Keith Donald * @author Juergen Hoeller @@ -88,7 +91,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser * single quote '. * @param expressionString the expression string * @return the parsed expressions - * @throws ParseException when the expressions cannot be parsed + * @throws ParseException if the expressions cannot be parsed */ private Expression[] parseExpressions(String expressionString, ParserContext context) throws ParseException { List expressions = new ArrayList<>(); @@ -229,7 +232,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser * @param expressionString the raw expression string to parse * @param context a context for influencing this expression parsing routine (optional) * @return an evaluator for the parsed expression - * @throws ParseException an exception occurred during parsing + * @throws ParseException if an exception occurred during parsing */ protected abstract Expression doParseExpression(String expressionString, @Nullable ParserContext context) throws ParseException;