jvmnewobj
jvmnewobj |
Purpose
Call
a public constructor in a Java class, returning the newly created object into Mosel as a
jvmobject value.
Synopsis
function jvmnewobj(classname:string) : jvmobject
function jvmnewobj(classname:string, ...) : jvmobject
Arguments
classname
|
The name of the Java class to create,
e.g.
"com.fico.examples.MathOperations"
|
...
|
Following the method name, specify zero or more values to pass as arguments to the Java constructor method.
|
Further information
1.
mosjvm will look in the class for a constructor with the given argument types. If such a constructor method cannot be found, the model will terminate with a runtime error.
2. The types of value that may be passed as method arguments are discussed earlier in this guide.
3. The returned
jvmobject value holds a reference to the Java object created. This reference will automatically be deleted when the model ends, or the
jvmobject variable is reset or falls out of scope, or
setvalue or
setnull is called for this object.
4. If
mosjvm has not yet loaded the Java Virtual Machine into the Mosel process, it will be loaded by this function. If Java cannot be found or an error occurs loading it, the model will terminate with a runtime error.
Related topics