Package jep

Class ClassList

  • All Implemented Interfaces:
    ClassEnquirer

    public class ClassList
    extends java.lang.Object
    implements ClassEnquirer
    A singleton that searches for loaded classes from the JRE and the Java classpath. This is the default ClassEnquirer that is used if no ClassEnquirer is specified when constructing an Interpreter. ClassList is also used by the command line jep script.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getClassNames​(java.lang.String pkg)
      get classnames in package
      static ClassList getInstance()
      get ClassList instance
      java.lang.String[] getSubPackages​(java.lang.String p)
      Given a Java package name, gets the sub-packages available.
      boolean isJavaPackage​(java.lang.String s)
      Checks if the String is known to the ClassList as an available package
      static void main​(java.lang.String[] argv)
      for testing only
      • Methods inherited from class java.lang.Object

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

      • getClassNames

        public java.lang.String[] getClassNames​(java.lang.String pkg)
        get classnames in package
        Specified by:
        getClassNames in interface ClassEnquirer
        Parameters:
        pkg - a String value
        Returns:
        String[] array of class names
      • getSubPackages

        public java.lang.String[] getSubPackages​(java.lang.String p)
        Description copied from interface: ClassEnquirer
        Given a Java package name, gets the sub-packages available. For example, a sub-package of package "java" is "util", and a sub-package of package "java.util" is "concurrent". This method is primarily used for introspection using Python's dir() method. This method can return null if dir() support is not necessary.
        Specified by:
        getSubPackages in interface ClassEnquirer
        Parameters:
        p - the name of a package the ClassEnquirer supports, such as java.util
        Returns:
        the list of sub-packages in the package, or null
      • isJavaPackage

        public boolean isJavaPackage​(java.lang.String s)
        Checks if the String is known to the ClassList as an available package
        Specified by:
        isJavaPackage in interface ClassEnquirer
        Parameters:
        s - a String to check
        Returns:
        if the String is considered a Java package
      • getInstance

        public static ClassList getInstance()
                                     throws JepException
        get ClassList instance
        Returns:
        ClassList instance
        Throws:
        JepException - if an error occurs
      • main

        public static void main​(java.lang.String[] argv)
                         throws java.lang.Throwable
        for testing only
        Parameters:
        argv - command line arguments
        Throws:
        java.lang.Throwable - if an error occurs