Class ClassHelper



  • public class ClassHelper
    extends Object
    This class contains some helpers to handle classes.
    • Method Detail

      • getInterfaces

        public static List<Class<?>> getInterfaces​(Class<?> clazz)
        Get all interfaces of the given class including extended interfaces and interfaces of all superclasses. If the given class is an interface, it will be included in the result, otherwise not.
        Parameters:
        clazz - The class to get the interfaces for.
        Returns:
        The interfaces of the given class.
      • getInterfacesAsStream

        public static Stream<Class<?>> getInterfacesAsStream​(Class<?> clazz)
        Get a stream of all interfaces of the given class including extended interfaces and interfaces of all superclasses. If the given class is an interface, it will be included in the result, otherwise not.
        Parameters:
        clazz - The class to get the interfaces for.
        Returns:
        The stream of interfaces of the given class.
      • getSuperclasses

        public static List<Class<?>> getSuperclasses​(Class<?> clazz)
        Get all superclasses of the given class. If the given class is an interface, the result will be empty. The given class will not be included in the result.
        Parameters:
        clazz - The class to get the superclasses for.
        Returns:
        The superclasses of the given class.
      • getSuperclassesAsStream

        public static Stream<Class<?>> getSuperclassesAsStream​(Class<?> clazz)
        Get a stream of all superclasses of the given class. If the given class is an interface, the result will be empty. The given class will not be included in the result.
        Parameters:
        clazz - The class to get the superclasses for.
        Returns:
        The stream of superclasses of the given class.