narrowing
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Halil_AKINCI
Posted On:   Friday, October 15, 2004 01:57 AM

Hi, Following code is a part of the idlj-generated HelloHelper class. when we think about HelloClient, what is returned by HelloHelper.narrow() method? It is stub? or HelloApp.Hello object? public static HelloApp.Hello narrow (org.omg.CORBA.Object obj){ if (obj == null) return null; else if (obj instanceof HelloApp.Hello) return (HelloApp.Hello)obj; else if (!obj._is_a (id ())) throw new org.omg.CORBA.BAD_PARAM (); else{ org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); HelloApp._HelloStub stub = new HelloApp._HelloStub (); stub._set_delegate(delegate); return stub; }   More>>

Hi,



Following code is a part of the idlj-generated HelloHelper class. when we think about HelloClient, what is returned by HelloHelper.narrow() method? It is stub? or HelloApp.Hello object?



			

public static HelloApp.Hello narrow (org.omg.CORBA.Object obj){
if (obj == null)
return null;
else if (obj instanceof HelloApp.Hello)
return (HelloApp.Hello)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
HelloApp._HelloStub stub = new HelloApp._HelloStub ();
stub._set_delegate(delegate);
return stub;
}
}


Sincerely...    <<Less

Re: narrowing

Posted By:   Anonymous  
Posted On:   Thursday, October 21, 2004 03:26 PM

The narrow is like a cast in Java. Here, it depends on whether obj is already of the type HelloApp.Hello, but if it is not, and supports that interface (by comparing the id), then the stub is created and returned .
About | Sitemap | Contact