|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbsh.classpath.BshClassPath
A BshClassPath encapsulates knowledge about a class path of URLs. It can maps all classes the path which may include: jar/zip files and base dirs A BshClassPath may composite other BshClassPaths as components of its path and will reflect changes in those components through its methods and listener interface. Classpath traversal is done lazily when a call is made to getClassesForPackage() or getClassSource() or can be done explicitily through insureInitialized(). Feedback on mapping progress is provided through the MappingFeedback interface. Design notes: Several times here we traverse ourselves and our component paths to produce a composite view of some thing relating to the path. This would be an opportunity for a visitor pattern.
Nested Class Summary | |
static class |
BshClassPath.AmbiguousName
|
static class |
BshClassPath.ClassSource
|
static class |
BshClassPath.DirClassSource
|
static class |
BshClassPath.JarClassSource
|
static interface |
BshClassPath.MappingFeedback
|
Nested classes inherited from class bsh.NameSource |
NameSource.Listener |
Constructor Summary | |
BshClassPath(String name)
|
|
BshClassPath(String name,
URL[] urls)
|
Method Summary | |
void |
add(URL url)
|
void |
add(URL[] urls)
|
void |
addComponent(BshClassPath bcp)
Add the specified BshClassPath as a component of our path. |
void |
addListener(ClassPathListener l)
|
static void |
addMappingFeedback(BshClassPath.MappingFeedback mf)
|
void |
addNameSourceListener(NameSource.Listener listener)
Implements NameSource Add a listener who is notified upon changes to names in this space. |
static String |
canonicalizeClassName(String name)
Create a proper class name from a messy thing. |
void |
classPathChanged()
|
String[] |
getAllNames()
|
static BshClassPath |
getBootClassPath()
Get the boot path including the lib/rt.jar if possible. |
Set |
getClassesForPackage(String pack)
Return the set of class names in the specified package including all component paths. |
String |
getClassNameByUnqName(String name)
Support for super import "*"; Get the full name associated with the unqualified name in this classpath. |
BshClassPath.ClassSource |
getClassSource(String className)
Return the source of the specified class which may lie in component path |
protected List |
getFullPath()
Get the full path including component paths. |
Set |
getPackagesSet()
Get a list of all of the known packages |
URL[] |
getPathComponents()
Get the path components including any component paths. |
static BshClassPath |
getUserClassPath()
A BshClassPath initialized to the user path from java.class.path |
static URL[] |
getUserClassPathComponents()
|
void |
insureInitialized()
If the claspath map is not initialized, do it now. |
protected void |
insureInitialized(boolean topPath)
|
static boolean |
isArchiveFileName(String name)
|
static boolean |
isClassFileName(String name)
|
static void |
main(String[] args)
|
static Collection |
removeInnerClassNames(Collection col)
Return a new collection without any inner class names |
void |
removeListener(ClassPathListener l)
|
void |
setPath(URL[] urls)
|
static String[] |
splitClassname(String classname)
Split class name into package and name |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BshClassPath(String name)
public BshClassPath(String name, URL[] urls)
Method Detail |
public void setPath(URL[] urls)
public void addComponent(BshClassPath bcp)
public void add(URL[] urls)
public void add(URL url) throws IOException
IOException
public URL[] getPathComponents()
public Set getClassesForPackage(String pack)
public BshClassPath.ClassSource getClassSource(String className)
public void insureInitialized()
protected void insureInitialized(boolean topPath)
topPath
- indicates that this is the top level classpath
component and it should send the startClassMapping messageprotected List getFullPath()
public String getClassNameByUnqName(String name) throws ClassPathException
ClassPathException
public String[] getAllNames()
getAllNames
in interface NameSource
public void classPathChanged()
classPathChanged
in interface ClassPathListener
public static boolean isClassFileName(String name)
public static boolean isArchiveFileName(String name)
public static String canonicalizeClassName(String name)
public static String[] splitClassname(String classname)
public static Collection removeInnerClassNames(Collection col)
public static URL[] getUserClassPathComponents() throws ClassPathException
ClassPathException
public Set getPackagesSet()
public void addListener(ClassPathListener l)
public void removeListener(ClassPathListener l)
public static BshClassPath getUserClassPath() throws ClassPathException
ClassPathException
public static BshClassPath getBootClassPath() throws ClassPathException
ClassPathException
public static void main(String[] args) throws Exception
Exception
public String toString()
public void addNameSourceListener(NameSource.Listener listener)
addNameSourceListener
in interface NameSource
public static void addMappingFeedback(BshClassPath.MappingFeedback mf)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |