In Object Oriented languages there is no _wrapObj method exposed to the user. Instead, the same functionality is achieved simply by calling ``new'' on the Impl class. Interestingly, this means the constructor functionality is NOT placed in a Babel ctor method, but is, instead, actually in the default object constructor.
Here is an excerpt from the class definition for wrapper.Data_Impl:
public String d_string; public int d_int; public String d_ctorTest; public Data_Impl(){ d_ior = _wrap(this); // DO-NOT-DELETE splicer.begin(wrapper.Data._wrap) d_ctorTest = "ctor was run"; // DO-NOT-DELETE splicer.end(wrapper.Data._wrap) } public void setString_Impl ( /*in*/ java.lang.String s ) throws sidl.RuntimeException.Wrapper { // DO-NOT-DELETE splicer.begin(wrapper.Data.setString) d_string = s; return ; // DO-NOT-DELETE splicer.end(wrapper.Data.setString) } public void setInt_Impl ( /*in*/ int i ) throws sidl.RuntimeException.Wrapper { // DO-NOT-DELETE splicer.begin(wrapper.Data.setInt) d_int = i; return ; // DO-NOT-DELETE splicer.end(wrapper.Data.setInt) }
Here is the client code from WrapTest.java:
public static void main(String args[]) { wrapper.Data_Impl d_data = new wrapper.Data_Impl(); wrapper.User d_user = new wrapper.User(); System.out.println(d_data.d_ctorTest); d_user.accept(d_data); System.out.println(d_data.d_string, d_data.d_int); }