Annotations - Missing doc + minor refactoring

This commit is contained in:
Emmanuel BENOîT 2015-09-17 11:09:13 +02:00
parent f3c535c967
commit 7aa5b93544

View file

@ -198,6 +198,15 @@ public final class Annotations
}
/**
* Finds all parent classes with a specific annotation
*
* @param klass
* the class to examine
* @param annotation
* the annotation to look for
* @return the list of classes that have the specified annotation amongst the specified class' ancestors
*/
public static < T > ArrayList< Class< ? super T > > findParentsWith( final Class< T > klass ,
final Class< ? extends Annotation > annotation )
{
@ -207,8 +216,19 @@ public final class Annotations
}
public static < T > void findParentsWith( ArrayList< Class< ? super T > > output , Class< T > klass ,
Class< ? extends Annotation > annotation )
/**
* Finds all parent classes with a specific annotation
*
* @param output
* the collection to which matching ancestors will be added
* @param klass
* the class to examine
* @param annotation
* the annotation to look for
* @return the collection to which matching ancestors were added
*/
public static < T > Collection< Class< ? super T > > findParentsWith( Collection< Class< ? super T > > output ,
Class< T > klass , Class< ? extends Annotation > annotation )
{
Class< ? super T > current = klass;
while ( current != null ) {
@ -217,6 +237,7 @@ public final class Annotations
}
current = current.getSuperclass( );
}
return output;
}
}