Provide a way to override the ReflectiveMethodResolver so that subclasses can provide thier own static methods [SPR-9038] #13677
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Satyapal Reddy opened SPR-9038 and commented
(I discussed this with Andy Clement on email)
We want to use a set of static methods declared on set of classes to be used as part of the expression evaluation. These methods are not declared on the rootObject being passed to Expression.getValue method.
One solution is to add our own MethodResolver to the list of resolvers on the StandardEvaluationContext. However doing that involves pretty much replicating the entire code of ReflectiveMethodResolver (except where we get methods from type) and then since compareArguments and compareArgumentsVarargs methods on ReflectionHelper are not public and also ReflectiveMethodExecutor class is not public, we need to duplicate lot of code.
However if ReflectiveMethodResolver could call a protected method getMethods(type), a subclass could just override it and provide its own static methods.
I am attaching the updated class as well as a Junit test case.
As we are using 3.0.5 version a backport would be great.
Affects: 3.0.5
Attachments:
Referenced from: commits 90bed97
The text was updated successfully, but these errors were encountered: