ClassList
Date: 2015-08-04

jep

## Class ClassList

- java.lang.Object
- - jep.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 Jep instances. ClassList is also used by the command line `jep` script.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(java.lang.String p)` classname contained in package
    `java.lang.String[]` | `getClassNames(java.lang.String p)` get classnames in package
    `static ClassList` | `getInstance()` get ClassList instance
    `static void` | `main(java.lang.String[] argv)` for testing only
    `boolean` | `supportsPackageImport()` Whether or not this ClassEnquirer supports importing Java classes at the package level in addition to the class level.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getClassNames

          public java.lang.String[] getClassNames(java.lang.String p)

      get classnames in package
      Specified by:
        `getClassNames` in interface `ClassEnquirer`
      Parameters:
        `p` - a `String` value
      Returns:
        `String[]` array of class names

    - #### contains

          public boolean contains(java.lang.String p)

      classname contained in package
      Specified by:
        `contains` in interface `ClassEnquirer`
      Parameters:
        `p` - a `String` value
      Returns:
        `String[]` array of class names

    - #### supportsPackageImport

          public boolean supportsPackageImport()

      Description copied from interface: `ClassEnquirer`
      Whether or not this ClassEnquirer supports importing Java classes at the package level in addition to the class level. For example, with the right ClassLoader Jep should always be able to successfully import Java classes with syntax such as:

           from java.util import ArrayList
           o = ArrayList()

      However, only in some scenarios can the package be imported separately without the fully qualified name, such as:

           import java.util as ju
           dir(ju)
           o = ju.ArrayList()

      This also roughly corresponds to whether or not `dir(javaPackage)` will return a list of available classes or only the classes that have been explicitly imported.
      Specified by:
        `supportsPackageImport` in interface `ClassEnquirer`
      Returns:
        true if this ClassEnquirer supports import of packages in addition to import of classes, false if it only supports importing classes.

    - #### 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