|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--org.omegahat.Environment.Utils.OrderedTable
|
+--org.omegahat.Environment.Tools.ClassList.ClassLocator
Find class definitions, more generally and flexibly than in Java
The methods in this class maintain and use a search path for Java
classes.
Given the name of a class, the findClass method looks it
up and returns the class object.
It tries harder than the Java method in class
ClassLoader, allowing partial specification of the class
name.
More importantly, the class supports a dynamic list of where to look,
with facilities for adding to the list.
The elements in the class list each identify a source for class
definitions.
That source can be a directory containing class files, a jar file, or a
location (URL) on the web.
Methods taking strings as input will try to resolve these sources;
methods taking files or URLs as arguments accept the arguments as
provided.
In addition, a ClassList object, however computed, can be
an element of the locator's internal list.
The methods provided allow for adding individual elements or appending multiple elements from any of these sources.
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Fields inherited from class org.omegahat.Environment.Utils.OrderedTable |
listeners, name, orderedElements, orderedKeys, state |
| Fields inherited from interface org.omegahat.Environment.Databases.Database |
ALL, ASSIGN, ATTACH, DETACH, NULL_ENTRY, READ, READ_WRITE, REMOVE |
| Fields inherited from interface org.omegahat.Environment.Databases.Activable |
ACTIVE, INACTIVE |
| Constructor Summary | |
ClassLocator()
|
|
ClassLocator(ClassList list)
initialize from another list of class lists (see general discussion above) |
|
ClassLocator(java.io.File f)
initialize from a file or directory (see general discussion above) |
|
ClassLocator(java.lang.String[] els)
initialize from strings (see general discussion above) |
|
ClassLocator(java.net.URL u)
initialize from a URL object (see general discussion above) |
|
ClassLocator(java.util.Vector els)
initialize from objects (see general discussion above) |
|
| Method Summary | |
java.lang.Object |
add(ClassList list)
add another list of class lists (see general discussion above) |
java.lang.Object |
add(java.io.File f)
add a file or directory (see general discussion above) |
java.lang.Object |
add(java.io.File[] f)
|
java.lang.Object |
add(java.lang.Object o)
add an object (see general discussion above) |
java.lang.Object |
add(java.lang.String name)
add class list identified by a string (see general discussion above) |
java.lang.Object |
add(java.lang.String[] names)
|
java.lang.Object |
add(java.net.URL u)
add a URL object (see general discussion above) |
java.lang.Object |
add(java.net.URL[] u)
|
int |
append(java.lang.String[] els)
append from strings (see general discussion above) |
int |
append(java.util.Vector els)
append objects (see general discussion above) |
boolean |
canReadSerializedLists(java.io.File f)
Determines whether read a serialized version of the list representing the specified file is acceptable. |
ClassList |
classList(java.io.File f)
Creates an appropriate ClassList object based on the characteristics of the specified file. |
ClassList |
classList(java.io.File f,
java.lang.String asSub)
|
ClassList |
classList(java.net.URL u)
Constructs a class list based on the contents of the URL. |
ClassList |
classList(java.net.URL u,
java.lang.String asSub)
|
java.lang.Class |
findClass(java.lang.String name)
Find a class by looking through the elements of the list in order and querying them for a match of the name. |
java.util.Vector |
findClasses(java.lang.String name,
java.util.Vector classes)
Find all the matching classes rather than just the first one |
java.lang.String |
serializedName(java.io.File f)
The name of the class property corresponding to the serialized version of the ClassList object for the specified file. |
| Methods inherited from class org.omegahat.Environment.Utils.OrderedTable |
add, addListListener, assign, assignSubset, attach, clear, copy, copy, detach, elementAt, exists, get, getName, getState, keys, listeners, listeners, notifyListeners, objects, ordered, orderedKeys, put, put, put, remove, remove, removeElement, removeElement, removeElementAt, removeElementAt, removeListListener, setElementAt, setName, setState, subset, subset, subset |
| Methods inherited from class java.util.Hashtable |
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.omegahat.Environment.Tools.ClassList.ClassLocatorInt |
containsKey, elements, get, orderedKeys, size |
| Methods inherited from interface org.omegahat.Environment.Databases.Database |
size |
| Constructor Detail |
public ClassLocator()
public ClassLocator(java.lang.String[] els)
public ClassLocator(java.util.Vector els)
public ClassLocator(java.io.File f)
public ClassLocator(java.net.URL u)
URL object (see general discussion above)public ClassLocator(ClassList list)
| Method Detail |
public java.lang.Class findClass(java.lang.String name)
throws java.lang.ClassNotFoundException
findClass in interface ClassLocatorInt
public java.util.Vector findClasses(java.lang.String name,
java.util.Vector classes)
ClassLocatorIntfindClasses in interface ClassLocatorIntpublic java.lang.Object add(java.io.File f)
public java.lang.Object add(java.io.File[] f)
public java.lang.Object add(java.net.URL u)
URL object (see general discussion above)public java.lang.Object add(java.net.URL[] u)
public java.lang.Object add(ClassList list)
public java.lang.Object add(java.lang.String name)
add in interface ClassLocatorIntpublic java.lang.Object add(java.lang.String[] names)
public java.lang.Object add(java.lang.Object o)
add in class OrderedTablepublic ClassList classList(java.io.File f)
getResource() method.
public ClassList classList(java.io.File f,
java.lang.String asSub)
f - the file.asSub - indicates whether the created ClassList will be
used as part of an import statement with a sub-directory
restricting the set of classes.public ClassList classList(java.net.URL u)
public ClassList classList(java.net.URL u,
java.lang.String asSub)
public int append(java.util.Vector els)
public int append(java.lang.String[] els)
public boolean canReadSerializedLists(java.io.File f)
public java.lang.String serializedName(java.io.File f)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||