vendredi 24 juillet 2015

How annotation check validation at runtime

I am working with custom annotation building ,I am creating some custom annotation that will validating some data.I am not able to write the annotation processor for that annotation.

i.e. I created a custom annotation UserRole as :

public @interface UserRole
{
    int[] value() default {0};
}

I will use this annotation as follow :

import java.util.List;
public class Demo
{
    public void checkValidUser(@UserRole({1,2})List<Integer> roles){
        // some code here
        }
}

I want to write Annotation processor so that I can check if given list contain any role that is specified in annotation at runtime because I will provide List at runtime. I need help to write that annotation processor.

Thanks in Advance.





Aucun commentaire:

Enregistrer un commentaire