lundi 17 octobre 2016

How to invoke private method in Gosu

I am trying to call a private method from gosu scratchpad using invoke() method.But i am not able to access that private method. Can any one tell me the best way to invoke private methods in GOSU Language.Here is the code

try{
    var clazz = java.lang.Class.forName(ClaimSearchCriteriaImpl)
    var method = clazz.getDeclaredMethod("generateSimpleActiveClaimViewQuery", null)
       method.setAccessible(true)
    var ss =   method.invoke(clazz, null)as ClaimSearchCriteriaImpl
       print("Result.."+ss)
} catch(exception){
        print("***********"+exception)
}

When i try to execute this code i am getting the following exception

java.lang.IllegalAccessException: Class program_.__Program__505 can not access a member of class com.guidewire.cc.domain.claim.impl.ClaimSearchCriteriaImpl with modifiers "private"
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:105)
    at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261)
    at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253)
    at java.lang.reflect.Method.invoke(Method.java:599)
    at program_.__Program__505.evaluate(Unknown Source)
    at gw.internal.gosu.parser.GosuProgram.runProgram(GosuProgram.java:421)
    at gw.internal.gosu.parser.GosuProgram.evaluate(GosuProgram.java:253)
    at gw.internal.gosu.parser.GosuProgram_Proxy.evaluate(gw.internal.gosu.parser.GosuProgram_Proxy:2)
    at gw.internal.gosu.parser.ExecutionEnvironment$1.evaluate(ExecutionEnvironment.java:543)
    at gw.internal.gosu.parser.ExecutionEnvironment$1.runScript(ExecutionEnvironment.java:523)
    at gw.internal.gosu.parser.ExecutionEnvironment$1.run(ExecutionEnvironment.java:489)
    at java.lang.Thread.run(Thread.java:724)





Aucun commentaire:

Enregistrer un commentaire