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

Narrowing Local Component

 
Dimiter Stoilov
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Object obj = ctx.getEJBLocalObject();
MyComponent comp = (MyComponent)PortableRemoteObject.narrow(obj, MyComponent.class);

1. What will happen if I narrow the Local Component instead of casting it?

2. Is it allowed?

3. Are there going to be any Exceptions?

Thank you guys,

Dimiter
(SJP, SCWCD)
[ August 21, 2004: Message edited by: Dimiter Stoilov ]
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. What will happen if I narrow the Local Component instead of casting it?

It will be the same as you use casting.


2. Is it allowed?

Yes, but in fact you dont need to do so, as for local components, we already know what it is.


3. Are there going to be any Exceptions?

No if you pass in the correct Class for narrowing. Yes if you passing in the wrong Class for narrowing.

Nick
 
Dimiter Stoilov
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Nicholas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic