Package jep
Class ClassList
java.lang.Object
jep.ClassList
- All Implemented Interfaces:
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.-
Field Summary
Fields inherited from interface jep.ClassEnquirer
RESTRICTED_PKG_NAMES
-
Method Summary
Modifier and TypeMethodDescriptionString[]
getClassNames
(String pkg) get classnames in packagestatic ClassList
get ClassList instanceString[]
Given a Java package name, gets the sub-packages available.boolean
Checks if the String is known to the ClassList as an available packagestatic void
for testing only
-
Method Details
-
getClassNames
get classnames in package- Specified by:
getClassNames
in interfaceClassEnquirer
- Parameters:
pkg
- aString
value- Returns:
String[]
array of class names
-
getSubPackages
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 interfaceClassEnquirer
- 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
Checks if the String is known to the ClassList as an available package- Specified by:
isJavaPackage
in interfaceClassEnquirer
- Parameters:
s
- aString
to check- Returns:
- if the String is considered a Java package
-
getInstance
get ClassList instance- Returns:
ClassList
instance- Throws:
JepException
- if an error occurs
-
main
for testing only- Parameters:
argv
- command line arguments- Throws:
Throwable
- if an error occurs
-