Skip to content

Commit fb0a108

Browse files
committed
Improve Javadoc for core SpEL APIs
1 parent c98f314 commit fb0a108

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

Diff for: spring-expression/src/main/java/org/springframework/expression/ExpressionParser.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,8 @@
1818

1919
/**
2020
* Parses expression strings into compiled expressions that can be evaluated.
21-
* Supports parsing templates as well as standard expression strings.
21+
*
22+
* <p>Supports parsing template expressions as well as standard expression strings.
2223
*
2324
* @author Keith Donald
2425
* @author Andy Clement
@@ -27,29 +28,31 @@
2728
public interface ExpressionParser {
2829

2930
/**
30-
* Parse the expression string and return an Expression object you can use for repeated evaluation.
31-
* <p>Some examples:
31+
* Parse the expression string and return an {@link Expression} object that
32+
* can be used for repeated evaluation.
33+
* <p>Examples:
3234
* <pre class="code">
3335
* 3 + 4
3436
* name.firstName
3537
* </pre>
3638
* @param expressionString the raw expression string to parse
37-
* @return an evaluator for the parsed expression
38-
* @throws ParseException an exception occurred during parsing
39+
* @return an {@code Expression} for the parsed expression
40+
* @throws ParseException if an exception occurred during parsing
3941
*/
4042
Expression parseExpression(String expressionString) throws ParseException;
4143

4244
/**
43-
* Parse the expression string and return an Expression object you can use for repeated evaluation.
44-
* <p>Some examples:
45+
* Parse the expression string and return an {@link Expression} object that
46+
* can be used for repeated evaluation.
47+
* <p>Examples:
4548
* <pre class="code">
4649
* 3 + 4
4750
* name.firstName
4851
* </pre>
4952
* @param expressionString the raw expression string to parse
50-
* @param context a context for influencing this expression parsing routine (optional)
51-
* @return an evaluator for the parsed expression
52-
* @throws ParseException an exception occurred during parsing
53+
* @param context a context for influencing the expression parsing routine
54+
* @return an {@code Expression} for the parsed expression
55+
* @throws ParseException if an exception occurred during parsing
5356
*/
5457
Expression parseExpression(String expressionString, ParserContext context) throws ParseException;
5558

Diff for: spring-expression/src/main/java/org/springframework/expression/ParserContext.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,16 +47,17 @@ public interface ParserContext {
4747
String getExpressionPrefix();
4848

4949
/**
50-
* For template expressions, return the prefix that identifies the end of an
50+
* For template expressions, returns the prefix that identifies the end of an
5151
* expression block within a string. For example: "}"
5252
* @return the suffix that identifies the end of an expression
5353
*/
5454
String getExpressionSuffix();
5555

5656

5757
/**
58-
* The default ParserContext implementation that enables template expression
59-
* parsing mode. The expression prefix is "#{" and the expression suffix is "}".
58+
* The default {@link ParserContext} implementation that enables template
59+
* expression parsing.
60+
* <p>The expression prefix is "#{", and the expression suffix is "}".
6061
* @see #isTemplate()
6162
*/
6263
ParserContext TEMPLATE_EXPRESSION = new ParserContext() {

Diff for: spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
import org.springframework.util.Assert;
3030

3131
/**
32-
* An expression parser that understands templates. It can be subclassed by expression
33-
* parsers that do not offer first class support for templating.
32+
* Abstract base class for {@linkplain ExpressionParser expression parsers} that
33+
* support templates.
34+
*
35+
* <p>Can be subclassed by expression parsers that offer first class support for
36+
* templating.
3437
*
3538
* @author Keith Donald
3639
* @author Juergen Hoeller
@@ -88,7 +91,7 @@ private Expression parseTemplate(String expressionString, ParserContext context)
8891
* single quote '.
8992
* @param expressionString the expression string
9093
* @return the parsed expressions
91-
* @throws ParseException when the expressions cannot be parsed
94+
* @throws ParseException if the expressions cannot be parsed
9295
*/
9396
private Expression[] parseExpressions(String expressionString, ParserContext context) throws ParseException {
9497
List<Expression> expressions = new ArrayList<>();
@@ -229,7 +232,7 @@ private int skipToCorrectEndSuffix(String suffix, String expressionString, int a
229232
* @param expressionString the raw expression string to parse
230233
* @param context a context for influencing this expression parsing routine (optional)
231234
* @return an evaluator for the parsed expression
232-
* @throws ParseException an exception occurred during parsing
235+
* @throws ParseException if an exception occurred during parsing
233236
*/
234237
protected abstract Expression doParseExpression(String expressionString, @Nullable ParserContext context)
235238
throws ParseException;

0 commit comments

Comments
 (0)