Class ClassList

    • Method Detail

      • getResources

        public static Collection<String> getResources​(Pattern pattern)
        For all elements of java.class.path get a Collection of resources Pattern pattern = Pattern.compile(".*"); gets all resources.
        Parameters:
        pattern - the pattern to match
        Returns:
        the resources in the order they are found
      • classList

        public static Collection<Class<?>> classList​(String packageRoot,
                                                     boolean excludeInterfaces)
        Return a List of all the classes under a package. Test-classes are excluded from the result.
        Parameters:
        packageRoot - String package name
        excludeInterfaces - boolean; if true; interfaces are excluded from the result
        Returns:
        Collection<Class<?>>; the classes under the package
      • isAnonymousInnerClass

        public static boolean isAnonymousInnerClass​(Class<?> c)
        Determine if a class is an anonymous inner class.
        Parameters:
        c - Class; the class to check
        Returns:
        boolean; true if c is an anonymous inner class; false otherwise
      • hasNonStaticFields

        public static boolean hasNonStaticFields​(Class<?> c)
        Report if a class has non-static fields.
        Parameters:
        c - Class<?>; the class
        Returns:
        boolean; true if the class has non-static fields
      • main

        public static void main​(String[] args)
        List the resources that match args[0], or a fixed pattern to demonstrate the use of this class.
        Parameters:
        args - args[0] is the pattern to match, or list all resources matching a built-in pattern if there are no args