Hi Everyone,
I'm using Rhino within ServiceNow to call a Java API from Javascript
This API requires to pass Lambda functions
This is an example:
identityNetwork.createDidTransaction(DidMethodOperation.CREATE)
.setDidDocument(didDocument)
.signDidDocument(doc -> didRootKey.sign(doc))
.buildAndSignTransaction(tx -> tx.setMaxTransactionFee(new Hbar(2))
.build(client))
.onDidDocumentReceived(msg -> {
System.out.println("DID document published!");
System.out.println(msg.getDidDocument());
})
.execute(client, client);
How can I pass these parameters from Javascript to Java? In the code, they're of type UnaryOperator.
I'm able to create an UnaryOperator of type identity
UnaryOperator = Packages["java"]["util"]["function"]["UnaryOperator"]
var x = UnaryOperator.identity()
for (i in x) {ms.log(i)}
ms.log(x)
*** Script: compose
*** Script: apply
*** Script: andThen
*** Script: java.util.function.UnaryOperator$$Lambda$155/229566071@7bc9a68f
but I don't see how to create it with my own function.
I've Rhino 1.7R5.
Thanks
Nicola