Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interfaces

 
Dura Hurtado
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, ¿could someone explain what way the next code works?


InterfaceName bean =(InterfaceName)context.lookup("JNDI-Name");


In bean, ¿is loaded an interface name or the code which is write in the EJB which correspond the interface name, or another way?

Thanks.
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The resource at "JNDI-NAME" is fetched from the JNDI and returned as an Object.
It is not an interface it is an Object.

The next step is to cast the resulted Object to the type you're expecting (in this case "InterfaceName").

Does this answer your question?
 
Dura Hurtado
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The resource at "JNDI-NAME" is fetched from the JNDI and returned as an Object.
It is not an interface it is an Object.

The next step is to cast the resulted Object to the type you're expecting (in this case "InterfaceName").

Does this answer your question?


Yes , thanks for your answer.
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's great :-)

Good luck!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic