org.specrunner.util
Class UtilAnnotations

java.lang.Object
  extended by org.specrunner.util.UtilAnnotations

public final class UtilAnnotations
extends Object

Utility Annotations class.

Author:
Thiago Santos

Method Summary
static List<Method> getAllDeclaredMethods(Class<?> type)
          Get all declared methods, from superclass to subclass in that order.
static
<T extends Annotation>
List<Method>
getAnnotatedMethods(Class<?> type, Class<T> annotation)
          Get annotations of a given type.
static
<T extends Annotation>
List<Method>
getAnnotatedMethods(Object instance, Class<T> annotation)
          Get annotations of a given object.
static List<Method> getMethods(Class<?> type)
          Get public methods of a type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAnnotatedMethods

public static <T extends Annotation> List<Method> getAnnotatedMethods(Object instance,
                                                                      Class<T> annotation)
Get annotations of a given object.

Type Parameters:
T - Annotation type.
Parameters:
instance - An object instance.
annotation - The annotation type.
Returns:
A list of methods with that annotation.

getAnnotatedMethods

public static <T extends Annotation> List<Method> getAnnotatedMethods(Class<?> type,
                                                                      Class<T> annotation)
Get annotations of a given type.

Type Parameters:
T - Annotation type.
Parameters:
type - A class type.
annotation - The annotation type.
Returns:
A list of methods with that annotation.

getMethods

public static List<Method> getMethods(Class<?> type)
Get public methods of a type.

Parameters:
type - A type.
Returns:
Methods list.

getAllDeclaredMethods

public static List<Method> getAllDeclaredMethods(Class<?> type)
Get all declared methods, from superclass to subclass in that order.

Parameters:
type - The method type.
Returns:
Methods list.


Copyright © 2015. All rights reserved.