Class Reflection


  • public class Reflection
    extends Object
    Utility methods for Reflections.
    Author:
    Hylke van der Schaaf
    • Constructor Detail

      • Reflection

        public Reflection()
    • Method Detail

      • getReflections

        public static org.reflections.Reflections getReflections()
      • getSubtypesOf

        public static Set<Class<?>> getSubtypesOf​(Class parent)
        Returns all subtypes of the given class or interface.
        Parameters:
        parent - The class or interface to get subtypes of.
        Returns:
        The list of classes.
      • getSubtypesOf

        public static List<Class<?>> getSubtypesOf​(Class parent,
                                                   boolean interfaces)
        Returns all subtypes of the given class or interface, excluding the given class itself. Optionally filtering out all interfaces.
        Parameters:
        parent - The class or interface to find subclasses of.
        interfaces - Should interfaces and abstract classes be included.
        Returns:
        The list of classes.
      • getSubtypesOf

        public static List<Class<?>> getSubtypesOf​(Class parent,
                                                   boolean interfaces,
                                                   boolean includeParent)
        Returns all subtypes of the given class or interface, optionally including the given class itself. Optionally filtering out all interfaces.
        Parameters:
        parent - The class or interface to find subclasses of.
        interfaces - Should interfaces and abstract classes be included.
        includeParent - Should the given parent class itself be returned.
        Returns:
        The list of classes.