Hi..i am refering the Spring In Action book for Spring. I am having problems understanding the Introduction(mix-in) topic under Spring AOP. Can sum1 pls suggest a better tutorial on same or explain wat it exactly is.
I'm assuming your question is "what does this feature do for me?" instead of "I understand what it does, but how do I make it work?"
If you have never used reflection, you probably won't care about introductions quite yet. Not saying that there aren't things you can't get out of introductions without reflection, more I'm just thinking of the learning curve. The reflection API is kind of the other half of what is going on; it tells you what is available in a class or object; handy for creating generic tools and frameworks. Introductions on the other help you make new stuff available that wasn't in the original java code for a class. Could be handy for adapting existing code to some tool or framework environment.
In the book they have an immutable mix-in as an example. If you compare that approach to the source of Struts you'll see Struts has a lot of objects to represent the struts-config files. Once those files are read the Java objects are "frozen" to make them immutable. Imagine ripping out that code for the cross-cutting concern and using the mix-in instead. That way all the config objects could be "frozen" but wouldn't have all those copies of source dealing with "frozenness". Their java source would just have the setters and getters necessary for the values populated by Digester.