How to found which class or method contain specific annotation?

Suppose we are having a class with separate user define annoation in same package like

@One

class A {

}

@Two

class B {

}

@One

class C {

}

How will I find which class is using @one annotation and which @Two?

OR

We are having a class in which methods are annotated and i want to retrieve which annotation is having which annotation

like :

class A {

@two

public method1() {

}

@one

public method2() {

}

@two

public method3() {

}

}

Any other idea to do something like this will be appreciated. Any help will be appreciated I am using core java reflection and annotations.

Original Scenario:-

Suppose i am having a class testcases having GUI ,Functional and others these three categories of testcase. i want to found method or class according to category and execute that method or class which ever is possible.

View Answers









Related Tutorials/Questions & Answers:
Advertisements