Package jep

Class ClassList

java.lang.Object
jep.ClassList
All Implemented Interfaces:
ClassEnquirer

public class ClassList extends 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 Details

    • getClassNames

      public String[] getClassNames(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 String[] getSubPackages(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(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(String[] argv) throws Throwable
      for testing only
      Parameters:
      argv - command line arguments
      Throws:
      Throwable - if an error occurs