Initializing help system before first use

Calling Java

Add uses 'mosjvm' to the top of your model then you can call any static Java method by passing its full class and method name to one fo the jvmcall<type> functions, where <type> represents the return type of the function, for example:

model myModel
  uses 'mosjvm'

  writeln('Integer return value=', jvmcallint('com.fico.MyClassName.myIntMethod'))
  writeln('String return value=', jvmcallstr('com.fico.MyClassName.myStringMethod'))
  writeln('Real return value with two parameters=',
          jvmcallreal('com.fico.MyClassName.myRealMethod', 5.7, true))
  writeln('Any object return value=', jvmcallobj('com.fico.MyClassName.myObjMethod'))
end-model

You can call jvmcallvoid if your Java method doesn't return anything. Any number of method arguments may be specified, from the following types:

  • boolean (translates to Java type: boolean)
  • integer (translates to Java type: int)
  • real (translates to Java type: double)
  • string (translates to Java type: java.lang.String)
  • text (translates to Java type: java.lang.String)
  • jvmobject
  • array of boolean (translates to Java type: boolean[])
  • array of integer (translates to Java type: int[])
  • array of real (translates to Java type: double[])
  • array of string (translates to Java type: java.lang.String[])
  • array of text (translates to Java type: java.lang.String[])
  • array of jvmobject (translates to Java type: java.lang.Object[])

Where an argument is an array, it must be indexed by a Mosel range starting from 0, e.g.:

model myModelAr
  uses 'mosjvm'
  declarations
    MyArray: array(range) of string
  end-declarations

  MyArray(0) := "zero"
  MyArray(1) := "one"
  MyArray(2) := "two"

  jvmcallvoid("com.fico.MyClassName.myMethodTakingArrayOfString", MyArray)
end-model

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.