createObject
The createObject method creates the actual underlying IDL object. The argc, argv, and argpal arguments are used to supply parameters to the underlying IDL object's Init method. If the Init method does not have any parameters, the caller sets argc, argv, and argpal to 0, null, and null, respectively. The initializer argument is used to specify IDL process initialization parameters (notably the IDL licensing mode).
The createObject method does the following:
The initListeners method has default behavior, which is different for drawable and nondrawable objects (see Event Handling for more information). If the default behavior is not desired, a subclass to modify the listener initialization can override the initListeners method.
Note
Registering or unregistering listeners for events should happen in the initListeners method or AFTER the createObject method.
Syntax
public void createObject( )
public void createObject(int argc, Object[] argv, int[] argpal)
public void createObject(int argc, Object[] argv, int[] argpal, JIDLProcessInitializer initializer)
public void createObject(JIDLProcessInitializer initializer)
Arguments
argc
The number of parameters to be passed to Init.
argv
The array of objects to be passed to IDL. This array should be of length argc and should contain objects of type JIDLNumber, JIDLObjectI, JIDLString, or JIDLArray.
argpal
An array of argc flags denoting whether each argv parameter that is of type array should be convolved or not. For parameters that are not arrays, the value within the array will always be 0.
initializer
A JIDLProcessInitializer object that encapsulates the IDL process initialization parameters. (Process initialization parameters allow the Java programmer to control the licensing mode of the IDL process. See IDL Licensing Modes for details on the default licensing mechanism.)
Example
The Init method of the IDL object being wrapped has the following signature:
where rect is an array of four integers and filename is a string.
The following is an example of Java client code that creates an instance of the wrapper object and calls the createObject method with the rect and filename parameters:
// These are the Java types we want to pass to the ::Init method int[] rect = {0, 0, 5, 10}; String file = "someFilename.txt"; // Wrap the Java types using Export Bridge data types JIDLArray bRect = new JIDLArray(rect); JIDLString bFile = new JIDLString(file); // Create the wrapper object MyWrapper wrapper = new MyWrapper(); // Set up parameters to pass to createObject final int ARGC = 2; Object[] argv = new Object[ARGC]; int[] argp = new int[ARGC]; argv[0] = bRect; argp[0] = JIDLConst.PARMFLAG_CONST; // "in-only" parameter argv[1] = bFile; argp[1] = JIDLConst.PARMFLAG_CONST; // "in-only" parameter // Create the underlying IDL object and call // its ::Init method with parameters and default IDL // process initialization settings wrapper.createObject(ARGC, argv, argp);Note
See Java Object Creation for additional examples of creating Java wrapper objects with and without parameters.