Refactor code that makes use of Java reflection
Closed this issue · 0 comments
Refactor code that makes use of Java reflection to not use Reflection as much as possible.
So that shapeshifter library code is less fragile and is easier to understand.
Minimise the code that performs Reflection: it might be possible to replace some of the custom code with Spring Framework classes.
Uses for example: UftpSerializer#typeFromXml, UftpForwardingMapping
In addition we should look at an alternative: now UFTP message handlers are UftpMapping annotated methods that can be in beans of any type, but what if we change that to requiring a bean to always implement a generic interface UftpMessageHandler containing a handle(T) }}method; this would allow Spring to do most of the heavy lifting for us. We'd only need to inject and match beans to {{PayloadMessageType. Much less custom code dealing with Reflection and more strongly typed.