• 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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!