lundi 27 novembre 2017

How to receive a callback from non native java method to C++

My Constraints are, I got a api.jar from client which I can not edit. The java code pasted below is from the test class which I wrote to test the api.jar.

Consumer<DemoAdapter> callbackLogin = demoAdapter -> { 
if (webBrowser != null) { 
webBrowser.stop(); 
} 
}; 
Consumer<DemoAdapter> callbackLogout = demoAdapter -> { 
if (webBrowser != null) { 
webBrowser.stop(); 
} 
}; 

// Create 
AdapterConfig config = Builder.buildConfig(); 

//Constructor which I need to call from C++;Issue is with above to consumer. 
keycloakAdapterApplication = new KeycloakAdapterApplication(callbackLogin,callbackLogout, config);

Now same jar(api.jar) I want to use from C++.So I am supposed to write the test class in C++ using JNI.

I wrote the test class for all the methods which doesn't involve Consumer & BiConsumer of java in their call.

The parameters mentioned above (callbackLogin,callbackLogout) receives callbacks in test class.

Please help me on how to create these two parameters at C++ side?

Aucun commentaire:

Enregistrer un commentaire