jeudi 4 août 2016

Invoking methods from Javassist, that have objects as parameter

I have following class structure -

class Student{
    int age;
    String name;
}

class Group{
   Student allStudents[10];
   int avgAge;
}

class Handler{

    public int myFunction(Group g){
        ...
        do something with 'g'
        ...
        return k;
    }
}

I want to invoke the function, 'myFunction' from Javassist using a custom 'Group' object and test the behaviour of the function for this object.

In a different scenario, I'm able to work with functions with parameters of primitive data type as follows-

ctBehavior.insertBefore("{for (int i=0; i < $args.length; i++) {System.out.println($args[i]);}}");

I want to do something like this for parameters that are custom objects.





Aucun commentaire:

Enregistrer un commentaire