Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why methods in bean interfaces are abstract?

 
Ravi Jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have one small query about the methods declared in SessionBean/EntityBean interfaces. Why the methods are declared "abstract" ? Since the methods are in an interface, so by-definition they are abstarct. So why these are explicitly declared as abstract?
For example, setSessionContext() and other methods declared in SessionBean interface are abstarct.
As per my understanding, there is no need to declare these methods as abstract, because they are abstarct by-definition. So I guess there must be some other reason for this (readability or maybe to force a user or container to provide implementation for these methods)
Thanks in advance..
Ravi Jain..
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct, declaring methods in an interface abstract (and public) is redundant. However, the interfaces that you are referring do not have methods declared as abstract, at least not according to the Javadocs here.
 
Ravi Jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,
Thanks for prompt reply and the link.
I checked out at that link and in EJB 1.0 docs, I found that in EJB 1.0, the methods were declared with abstarct.
And even in EJB 2.0, the interfaces (like javax.ejb.EJBObject) are defined as abstract interfaces.
Are there any specific reasons behind this ?
Thanks again,
Ravi..
 
Ravi Jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can check out the link for setSessionContext() method of EJB1.0 specifcation here:
http://java.sun.com/products/ejb/javadoc-1.0
Thanks,
Ravi..
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just some programmer having fun. I'm surprised they would allow such a thing in a spec.
abstract and public on an interface are meaningless. In fact I would suggest they be illegal to avoid just this type of confusion.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic