MCPcopy Create free account
hub / github.com/beanshell/beanshell / BshClassPath

Class BshClassPath

src/bsh/classpath/BshClassPath.java:59–882  ·  view source on GitHub ↗

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 lis

Source from the content-addressed store, hash-verified

57 be an opportunity for a visitor pattern.
58*/
59public class BshClassPath
60 implements ClassPathListener, NameSource
61{
62 String name;
63
64 /** The URL path components */
65 private List path;
66 /** Ordered list of components BshClassPaths */
67 private List compPaths;
68
69 /** Set of classes in a package mapped by package name */
70 private Map packageMap;
71 /** Map of source (URL or File dir) of every clas */
72 private Map classSource;
73 /** The packageMap and classSource maps have been built. */
74 private boolean mapsInitialized;
75
76 private UnqualifiedNameTable unqNameTable;
77
78 /**
79 This used to be configurable, but now we always include them.
80 */
81 private boolean nameCompletionIncludesUnqNames = true;
82
83 Vector listeners = new Vector();
84
85 // constructors
86
87 public BshClassPath( String name ) {
88 this.name = name;
89 reset();
90 }
91
92 public BshClassPath( String name, URL [] urls ) {
93 this( name );
94 add( urls );
95 }
96
97 // end constructors
98
99 // mutators
100
101 public void setPath( URL[] urls ) {
102 reset();
103 add( urls );
104 }
105
106 /**
107 Add the specified BshClassPath as a component of our path.
108 Changes in the bcp will be reflected through us.
109 */
110 public void addComponent( BshClassPath bcp ) {
111 if ( compPaths == null )
112 compPaths = new ArrayList();
113 compPaths.add( bcp );
114 bcp.addListener( this );
115 }
116

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected