Recently, I had to look back at some of the pieces I coded a few years back and found a generics trick I had forgotten. Thought of sharing with everyone.
Most of the time when we are working with Dependency Injection, Caching, Helper
methods etc, we are not aware of the type of object a method may return. Perfect
examples to the same could be the use of
ApplicationContext.getBean, and alike. What we do at such hour is simply, define
the return type of the method as
Object and then cast back to the required original such as,
Read the full post here.