ClassEnquirer
Date: 2015-08-04

jep

## Interface ClassEnquirer

- All Known Implementing Classes:
    ClassList, NamingConventionClassEnquirer

      public interface ClassEnquirer

  Interface to enquire if a name is available to be imported from Java. Used by Jep's importer hook (see PEP 302) to determine if an attempt to import a module/package or class should be directed to the Python importer or the Java `ClassLoader`.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(java.lang.String name)` Checks if the name is likely available in Java.
    `java.lang.String[]` | `getClassNames(java.lang.String pkgName)` Given a Java package name, gets the fully-qualified classnames available for import in the package.
    `boolean` | `supportsPackageImport()` Whether or not this ClassEnquirer supports importing Java classes at the package level in addition to the class level.

- - ### Method Detail

    - #### contains

          boolean contains(java.lang.String name)

      Checks if the name is likely available in Java. A return value of true implies the name corresponds to a Java package or class, but does not guarantee that an import will succeed. A return value of false implies that an import from Java would fail, but does not guarantee that an import will fail.
      Parameters:
        `name` - the name to check, such as java, java.util, java.util.ArrayList
      Returns:
        true if it's likely supported by Java, false if it's likely python

    - #### supportsPackageImport

          boolean supportsPackageImport()

      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.
      Returns:
        true if this ClassEnquirer supports import of packages in addition to import of classes, false if it only supports importing classes.

    - #### getClassNames

          java.lang.String[] getClassNames(java.lang.String pkgName)

      Given a Java package name, gets the fully-qualified classnames available for import in the package. In general this method should return null if `supportsPackageImport()` returns false.
      Parameters:
        `pkgName` - the name of a package the ClassEnquirer supports, such as java.util
      Returns:
        the list of classnames in the package