diff --git a/spring-context/src/main/java/org/springframework/context/expression/AnnotatedElementKey.java b/spring-context/src/main/java/org/springframework/context/expression/AnnotatedElementKey.java index 194d6ca133c..08673db5e6b 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/AnnotatedElementKey.java +++ b/spring-context/src/main/java/org/springframework/context/expression/AnnotatedElementKey.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. @@ -23,8 +23,8 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * Represent an {@link AnnotatedElement} on a particular {@link Class} - * and is suitable as a key. + * Represents an {@link AnnotatedElement} in a particular {@link Class} + * and is suitable for use as a cache key. * * @author Costin Leau * @author Stephane Nicoll diff --git a/spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.java b/spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.java index ffd9ff96984..70683bcdf71 100644 --- a/spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.java +++ b/spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.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. @@ -24,11 +24,10 @@ import org.springframework.expression.Expression; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.lang.Nullable; import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; /** * Shared utility class used to evaluate and cache SpEL expressions that - * are defined on {@link java.lang.reflect.AnnotatedElement}. + * are defined on an {@link java.lang.reflect.AnnotatedElement AnnotatedElement}. * * @author Stephane Nicoll * @since 4.2 @@ -41,6 +40,13 @@ public abstract class CachedExpressionEvaluator { private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer(); + /** + * Create a new instance with the default {@link SpelExpressionParser}. + */ + protected CachedExpressionEvaluator() { + this(new SpelExpressionParser()); + } + /** * Create a new instance with the specified {@link SpelExpressionParser}. */ @@ -49,13 +55,6 @@ public abstract class CachedExpressionEvaluator { this.parser = parser; } - /** - * Create a new instance with a default {@link SpelExpressionParser}. - */ - protected CachedExpressionEvaluator() { - this(new SpelExpressionParser()); - } - /** * Return the {@link SpelExpressionParser} to use. @@ -72,12 +71,13 @@ public abstract class CachedExpressionEvaluator { return this.parameterNameDiscoverer; } - /** - * Return the {@link Expression} for the specified SpEL value - *
{@link #parseExpression(String) Parse the expression} if it hasn't been already. + * Return the parsed {@link Expression} for the specified SpEL expression. + *
{@linkplain #parseExpression(String) Parses} the expression if it hasn't
+ * already been parsed and cached.
* @param cache the cache to use
- * @param elementKey the element on which the expression is defined
+ * @param elementKey the {@code AnnotatedElementKey} containing the element
+ * on which the expression is defined
* @param expression the expression to parse
*/
protected Expression getExpression(Map