• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dumb Interfaces Question  RSS feed

 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was working with Struts-2 today and I noticed that one can implement the interface ServletSessionAware (or something like that) and if the interface is implemented and you implement the method as per the interface, the system will call that method. And if you leave the interface off, the system wont call the method and the method can be omitted.

I was curious as to how that works, i.e.: how do you write code that detects if an interface is present and if so, call the method?

Does the question make sense?

Thanks,

Billy
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instanceof

You *could* just look at the source code for the interceptor...
 
Billy Vandory
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


David Newton wrote:instanceof

You *could* just look at the source code for the interceptor...


Yeah, I spent about 15 minutes looking through it, but I didn't know what i was looking for. And I didn't have much time left, so I asked here.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fifteen minutes? Hmm. I've stripped out the license and Javadocs; there's 64 lines left. Maybe try looking again?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!