de.fub.bytecode
Class Repository

java.lang.Object
  |
  +--de.fub.bytecode.Repository

public abstract class Repository
extends java.lang.Object

Repository maintains informations about class interdependencies, e.g. whether a class is a sub-class of another. JavaClass objects are put into a cache which can be purged with clearCache(). All JavaClass objects used as arguments must have been obtained via the repository or been added with addClass() manually. This is because we have to check for object identity (==).

Version:
$Id: Repository.java,v 1.10 2001/08/08 14:01:11 dahm Exp $
Author:
M. Dahm

Constructor Summary
Repository()
           
 
Method Summary
static JavaClass addClass(JavaClass clazz)
          Add clazz to repository if there isn't an equally named class already in there.
static void clearCache()
          Clear the repository.
static JavaClass[] getInterfaces(JavaClass clazz)
           
static JavaClass[] getInterfaces(java.lang.String class_name)
           
static JavaClass[] getSuperClasses(JavaClass clazz)
           
static JavaClass[] getSuperClasses(java.lang.String class_name)
           
static boolean implementationOf(JavaClass clazz, JavaClass inter)
           
static boolean implementationOf(JavaClass clazz, java.lang.String inter)
           
static boolean implementationOf(java.lang.String clazz, JavaClass inter)
           
static boolean implementationOf(java.lang.String clazz, java.lang.String inter)
           
static boolean instanceOf(JavaClass clazz, JavaClass super_class)
           
static boolean instanceOf(JavaClass clazz, java.lang.String super_class)
           
static boolean instanceOf(java.lang.String clazz, JavaClass super_class)
           
static boolean instanceOf(java.lang.String clazz, java.lang.String super_class)
           
static JavaClass lookupClass(java.lang.String class_name)
           
static ClassPath.ClassFile lookupClassFile(java.lang.String class_name)
           
static void removeClass(JavaClass clazz)
          Remove given class from repository.
static void removeClass(java.lang.String clazz)
          Remove class with given (fully qualifid) name from repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Repository

public Repository()
Method Detail

lookupClass

public static JavaClass lookupClass(java.lang.String class_name)
Returns:
class object for given fully qualified class name.

lookupClassFile

public static ClassPath.ClassFile lookupClassFile(java.lang.String class_name)
Returns:
class file object for given Java class.

clearCache

public static void clearCache()
Clear the repository.

addClass

public static JavaClass addClass(JavaClass clazz)
Add clazz to repository if there isn't an equally named class already in there.
Returns:
old entry in repository

removeClass

public static void removeClass(java.lang.String clazz)
Remove class with given (fully qualifid) name from repository.

removeClass

public static void removeClass(JavaClass clazz)
Remove given class from repository.

getSuperClasses

public static JavaClass[] getSuperClasses(JavaClass clazz)
Returns:
list of super classes of clazz in ascending order, i.e., Object is always the last element

getSuperClasses

public static JavaClass[] getSuperClasses(java.lang.String class_name)
Returns:
list of super classes of clazz in ascending order, i.e., Object is always the last element. "null", if clazz cannot be found.

getInterfaces

public static JavaClass[] getInterfaces(JavaClass clazz)
Returns:
all interfaces implemented by class and its super classes and the interfaces that those interfaces extend, and so on

getInterfaces

public static JavaClass[] getInterfaces(java.lang.String class_name)
Returns:
all interfaces implemented by class and its super classes and the interfaces that extend those interfaces, and so on

instanceOf

public static boolean instanceOf(JavaClass clazz,
                                 JavaClass super_class)
Returns:
true, if clazz is an instance of super_class

instanceOf

public static boolean instanceOf(java.lang.String clazz,
                                 java.lang.String super_class)
Returns:
true, if clazz is an instance of super_class

instanceOf

public static boolean instanceOf(JavaClass clazz,
                                 java.lang.String super_class)
Returns:
true, if clazz is an instance of super_class

instanceOf

public static boolean instanceOf(java.lang.String clazz,
                                 JavaClass super_class)
Returns:
true, if clazz is an instance of super_class

implementationOf

public static boolean implementationOf(JavaClass clazz,
                                       JavaClass inter)
Returns:
true, if clazz is an implementation of interface inter

implementationOf

public static boolean implementationOf(java.lang.String clazz,
                                       java.lang.String inter)
Returns:
true, if clazz is an implementation of interface inter

implementationOf

public static boolean implementationOf(JavaClass clazz,
                                       java.lang.String inter)
Returns:
true, if clazz is an implementation of interface inter

implementationOf

public static boolean implementationOf(java.lang.String clazz,
                                       JavaClass inter)
Returns:
true, if clazz is an implementation of interface inter