When using LS2J to utilize Java classes from within LotusScript, you may be faced with needing to declare and bind to a method explicitly using its JNI signature. A common case where this is necesary is when your Java class has multiple overridden methods and you need to explicitly use one of them. Instead of wrestling with the JNI syntax, you can use this handy function to bind to the object and print out the signatures for you to copy:
Function getMethodSignatures(jClass As Javaclass, l As noteslog) Dim msg$ Dim methods As JavaMethodCollection Set methods = jclass.Getclassmethods() ForAll meth In methods msg$ = meth.Methodname & " - SIG: " & meth.Signature If Not(l Is Nothing) Then Call l.logaction(msg$) Print msg$ End ForAll End Function
A sample output from the NotesLog looks like this:
Started running agent 'LS Method Enumerator Test' on 01/21/2010 03:25:25 PM 01/21/2010 03:25:26 PM: equals - SIG: (Ljava/lang/Object;)Z 01/21/2010 03:25:26 PM: hashCode - SIG: ()I 01/21/2010 03:25:26 PM: toString - SIG: ()Ljava/lang/String; 01/21/2010 03:25:26 PM: generate - SIG: (Ljava/lang/String;Ljava/lang/String;Ljava/util/HashMap;)V 01/21/2010 03:25:26 PM: setPageOrientation - SIG: (Z)V 01/21/2010 03:25:26 PM: generate - SIG: (Ljava/lang/String;Ljava/lang/String;)V 01/21/2010 03:25:26 PM: addToRoot - SIG: (Ljava/lang/String;Ljava/lang/Object;)V 01/21/2010 03:25:26 PM: removeFromRoot - SIG: (Ljava/lang/String;)V 01/21/2010 03:25:26 PM: resetRoot - SIG: ()V 01/21/2010 03:25:26 PM: getClass - SIG: ()Ljava/lang/Class; 01/21/2010 03:25:26 PM: notify - SIG: ()V 01/21/2010 03:25:26 PM: notifyAll - SIG: ()V 01/21/2010 03:25:26 PM: wait - SIG: ()V 01/21/2010 03:25:26 PM: wait - SIG: (J)V 01/21/2010 03:25:26 PM: wait - SIG: (JI)V 01/21/2010 03:25:26 PM: main - SIG: ([Ljava/lang/String;)V Ran LotusScript code Done running agent 'LS Method Enumerator Test' on 01/21/2010 03:25:26 PM
Kindly rate this post using the star system below and/or rate my authoring abilities on Scribnia.