mardi 18 septembre 2018

Annotate a function and detect when it is called at Runtime - Kotlin/Java

Hello let me try to make this clear: I want to do almost the same thing the Android annotations do. For example :

@RequiresApi(Build.VERSION_CODES.LOLLIPOP) public void someFunction() {}

I would like to make something similar but at Runtime. Annotate a function and when that function is called, i make a treatement (probably using reflection) and depending on the result i proceed to run or not the annotated function. Something like:

@IsLoggedIn() public void someFunction() {}

The someFunction() function will be executed only if the user is logged in.





Aucun commentaire:

Enregistrer un commentaire