Class ClassList

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Collection<java.lang.Class<?>> classList​(java.lang.String packageRoot, boolean excludeInterfaces)
      Return a List of all the classes under a package.
      static java.util.Collection<java.lang.String> getResources​(java.util.regex.Pattern pattern)
      For all elements of java.class.path get a Collection of resources Pattern pattern = Pattern.compile(".*"); gets all resources.
      static boolean hasNonStaticFields​(java.lang.Class<?> c)
      Report if a class has non-static fields.
      static boolean isAnonymousInnerClass​(java.lang.Class<?> c)
      Determine if a class is an anonymous inner class.
      static void main​(java.lang.String[] args)
      List the resources that match args[0], or a fixed pattern to demonstrate the use of this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getResources

        public static java.util.Collection<java.lang.String> getResources​(java.util.regex.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 java.util.Collection<java.lang.Class<?>> classList​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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