Interface ReflectionService

    • Method Detail

      • getSubTypesOf

        <T> Set<Class<? extends T>> getSubTypesOf​(Class<T> type)
        Gets the set of classes that are subtypes of a given type.
        Parameters:
        type - the base type
        Returns:
        set of types that implement/extend type
      • getTypesAnnotatedWith

        Set<Class<?>> getTypesAnnotatedWith​(Class<? extends Annotation> annotation)
        Gets the set of classes that have a given (type-level) annotation.
        Parameters:
        annotation - the subject annotation
        Returns:
        set of classes
      • getAnnotation

        <A extends Annotation> A getAnnotation​(Class<?> subjectType,
                                               Class<A> annotationType)
        Gets an annotation on a type.
        Type Parameters:
        A - annotation type
        Parameters:
        subjectType - the subject type
        annotationType - class representating the annotation type
        Returns:
        annotation instance or null if there is no annotation of type A on subjectType
      • getAnnotation

        <A extends Annotation> A getAnnotation​(Method subjectMethod,
                                               Class<A> annotationType)
        Gets an annotation on a method.
        Type Parameters:
        A - annotation type
        Parameters:
        subjectMethod - the subject method
        annotationType - class representating the annotation type
        Returns:
        annotation instance or null if there is no annotation of type A on subjectType
      • isAbstractType

        boolean isAbstractType​(Class<?> type)
        Tests whether the given type is an interface or abstract class.
        Parameters:
        type - the subject type
        Returns:
        true if type is an interface or an abstract class
      • getMethods

        Method[] getMethods​(Class<?> type)
        Gets the public methods of the given type.
        Parameters:
        type - the subject type
        Returns:
        array containing the public methods of type
      • getReturnType

        Class<?> getReturnType​(Method method)
        Gets the return type of the given method.
        Parameters:
        method - the subject method
        Returns:
        return type