lundi 29 juin 2015

Stop method execution at run time via reflection

I have this idea of an android library I want to write. I need to be able to annotate a method; At run time a check for connectivity will be done. If this condition is true the method should continue; if it's false then the method should be terminated.

I'm wondering if this can be accomplished via reflection or some other means. I saw that there are programs that modify code at run time so I was thinking I would have to put "inject" a return statement at the beginning of the method. However I should be able to restore the method to its original statement even if I injected a return statement before it's execution because if internet were enabled and the method is called again then it should be executed. Not sure if I am talking gibberish but nevertheless, any thoughts would be greatly appreciated.





Aucun commentaire:

Enregistrer un commentaire