restygwt/src/main/java/org/fusesource/restygwt/rebind/util/AnnotationUtils.java
public static Annotation[] getAnnotationsInTypeHierarchy(JClassType classType) {
        Set<Annotation> resultAnnotations = new HashSet<Annotation>();

        // Cache to avoid loops
        Set<JClassType> alreadyCheckedTypes = new HashSet<JClassType>();

        // Work queue
        Queue<JClassType> typeQueue = new LinkedList<JClassType>();

        for (JClassType current = classType; current != null; current = typeQueue.poll()) {
            if (!alreadyCheckedTypes.add(current)) {
                continue;
            }

            // Get the annotations only from current, no inherited
            Annotation[] annotations = current.getDeclaredAnnotations();
            Collections.addAll(resultAnnotations, annotations);

            if (current.getSuperclass() != null) {
                // Add the superclass to the queue
                typeQueue.add(current.getSuperclass());
            }

            // Add the Superinterfaces to the queue
            Collections.addAll(typeQueue, current.getImplementedInterfaces());
        }

        return resultAnnotations.toArray(new Annotation[resultAnnotations.size()]);
    }
public static Annotation[] getAnnotationsInTypeHierarchy(JClassType classType) {
        Set<Annotation> resultAnnotations = new HashSet<Annotation>();

        // Cache to avoid loops
        Set<JClassType> alreadyCheckedTypes = new HashSet<JClassType>();

        // Work queue
        Queue<JClassType> typeQueue = new LinkedList<JClassType>();

        for (JClassType current = classType; current != null; current = typeQueue.poll()) {
            if (!alreadyCheckedTypes.add(current)) {
                continue;
            }

            // Get the annotations only from current, no inherited
            Annotation[] annotations = current.getDeclaredAnnotations();
            Collections.addAll(resultAnnotations, annotations);

            if (current.getSuperclass() != null) {
                // Add the superclass to the queue
                typeQueue.add(current.getSuperclass());
            }

            // Add the Superinterfaces to the queue
            Collections.addAll(typeQueue, current.getImplementedInterfaces());
        }

        return resultAnnotations.toArray(new Annotation[resultAnnotations.size()]);
    }
public static Annotation [ ] getAnnotationsInTypeHierarchy ( JClassType classType ) { Set < Annotation > resultAnnotations = new HashSet < Annotation > ( ) ; // Cache to avoid loops Set < JClassType > alreadyCheckedTypes = new HashSet < JClassType > ( ) ; // Work queue Queue < JClassType > typeQueue = new LinkedList < JClassType > ( ) ; for ( JClassType current = classType ; current != null ; current = typeQueue . poll ( ) ) { if ( ! alreadyCheckedTypes . add ( current ) ) { continue ; } // Get the annotations only from current, no inherited Annotation [ ] annotations = current . getDeclaredAnnotations ( ) ; Collections . addAll ( resultAnnotations , annotations ) ; if ( current . getSuperclass ( ) != null ) { // Add the superclass to the queue typeQueue . add ( current . getSuperclass ( ) ) ; } // Add the Superinterfaces to the queue Collections . addAll ( typeQueue , current . getImplementedInterfaces ( ) ) ; } return resultAnnotations . toArray ( new Annotation [ resultAnnotations . size ( ) ] ) ; }
Get all annotations from superclasses and superinterfaces.<br>
<br>
Works like {@link JClassType#findAnnotationInTypeHierarchy(Class)} but returns all annotations in the type
hierarchy.

@author Ralf Sommer {@literal <ralf.sommer.dev@gmail.com>}

@param classType
@return annotations
Get all annotations from superclasses and superinterfaces . <br > <br > Works like { @link JClassType#findAnnotationInTypeHierarchy ( Class ) } but returns all annotations in the type hierarchy .