How can i get a list of all available annotations of some class

Is there a way I can show user a list of all available annotations related to some class , for example all annotations available with in hibernate , or under javax.persistence.

Like , to be more specific, When i write @ in Eclipse and hit CtlSpace. I get this list http://screencast.com/t/tLAVFdi46OiB

I want to show this whole list somewhere in my application's Interface.

there must be some where this list is coming from , From where i can fetch this list .

Any idea

thanks

Answers


All annotations implement the Annotation interface. Therefore, you can try something like this to find all annotations in the org.hibernate package (see Reflections javadocs):

Reflections reflections = new Reflections("org.hibernate");
Set<Class<? extends Annotation>> annotations  = reflections.getSubTypesOf(Annotation.class);

You'll need the Reflections library, which relies on Guava and Javassist. If you're using IntelliJ and gradle (which I suggest) you can include this in your gradle file:

compile 'org.reflections:reflections-maven:0.9.9-RC2'
compile 'com.google.guava:guava:18.0'
compile 'javassist:javassist:3.12.1.GA'

Need Your Help

Emulate super in javascript

javascript oop super

Basically is there a good elegant mechanism to emulate super with syntax that is as simple as one of the following

Unsupported driver [oracle] in Laravel 5 when using yajra/laravel-oci8

oracle11g laravel-5 oci8

I've seen that this question has been made Unsupported driver in laravel 4 when using laravel-oci8 package but the answere wasn't really usefull since the thread specify on https://github.com/yajra/