FileDocCategorySizeDatePackage
Repository.javaAPI DocJava SE 6 API8561Tue Jun 10 00:22:16 BST 2008com.sun.org.apache.bcel.internal

Repository

public abstract class Repository extends Object
The repository maintains informations about class interdependencies, e.g., whether a class is a sub-class of another. Delegates actual class loading to SyntheticRepository with current class path by default.
see
com.sun.org.apache.bcel.internal.util.Repository
see
com.sun.org.apache.bcel.internal.util.SyntheticRepository
version
$Id: Repository.java,v 1.1.2.1 2005/07/31 23:46:55 jeffsuttor Exp $
author
M. Dahm

Fields Summary
private static Repository
_repository
Constructors Summary
Methods Summary
public static com.sun.org.apache.bcel.internal.classfile.JavaClassaddClass(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz)
Add clazz to repository if there isn't an equally named class already in there.

return
old entry in repository

    JavaClass old = _repository.findClass(clazz.getClassName());
    _repository.storeClass(clazz);
    return old;
  
public static voidclearCache()
Clear the repository.

    _repository.clear();
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClass[]getInterfaces(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz)

return
all interfaces implemented by class and its super classes and the interfaces that those interfaces extend, and so on. (Some people call this a transitive hull).

    return clazz.getAllInterfaces();
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClass[]getInterfaces(java.lang.String class_name)

return
all interfaces implemented by class and its super classes and the interfaces that extend those interfaces, and so on

    return getInterfaces(lookupClass(class_name));
  
public static com.sun.org.apache.bcel.internal.util.RepositorygetRepository()

return
currently used repository instance


          
      
    return _repository;
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClass[]getSuperClasses(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz)

return
list of super classes of clazz in ascending order, i.e., Object is always the last element

    return clazz.getSuperClasses();
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClass[]getSuperClasses(java.lang.String class_name)

return
list of super classes of clazz in ascending order, i.e., Object is always the last element. return "null", if class cannot be found.

    JavaClass jc = lookupClass(class_name);
    return (jc == null? null : getSuperClasses(jc));
  
public static booleanimplementationOf(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz, com.sun.org.apache.bcel.internal.classfile.JavaClass inter)

return
true, if clazz is an implementation of interface inter

    return clazz.implementationOf(inter);
  
public static booleanimplementationOf(java.lang.String clazz, java.lang.String inter)

return
true, if clazz is an implementation of interface inter

    return implementationOf(lookupClass(clazz), lookupClass(inter));
  
public static booleanimplementationOf(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz, java.lang.String inter)

return
true, if clazz is an implementation of interface inter

    return implementationOf(clazz, lookupClass(inter));
  
public static booleanimplementationOf(java.lang.String clazz, com.sun.org.apache.bcel.internal.classfile.JavaClass inter)

return
true, if clazz is an implementation of interface inter

    return implementationOf(lookupClass(clazz), inter);
  
public static booleaninstanceOf(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz, com.sun.org.apache.bcel.internal.classfile.JavaClass super_class)
Equivalent to runtime "instanceof" operator.

return
true, if clazz is an instance of super_class

    return clazz.instanceOf(super_class);
  
public static booleaninstanceOf(java.lang.String clazz, java.lang.String super_class)

return
true, if clazz is an instance of super_class

    return instanceOf(lookupClass(clazz), lookupClass(super_class));
  
public static booleaninstanceOf(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz, java.lang.String super_class)

return
true, if clazz is an instance of super_class

    return instanceOf(clazz, lookupClass(super_class));
  
public static booleaninstanceOf(java.lang.String clazz, com.sun.org.apache.bcel.internal.classfile.JavaClass super_class)

return
true, if clazz is an instance of super_class

    return instanceOf(lookupClass(clazz), super_class);
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClasslookupClass(java.lang.String class_name)
Lookup class somewhere found on your CLASSPATH, or whereever the repository instance looks for it.

return
class object for given fully qualified class name, or null if the class could not be found or parsed correctly

    try {
      JavaClass clazz = _repository.findClass(class_name);

      if(clazz == null) {
	return _repository.loadClass(class_name);
      } else {
	return clazz;
      }
    } catch(ClassNotFoundException ex) { return null; }
  
public static com.sun.org.apache.bcel.internal.classfile.JavaClasslookupClass(java.lang.Class clazz)
Try to find class source via getResourceAsStream().

see
Class
return
JavaClass object for given runtime class

    try {
      return _repository.loadClass(clazz);
    } catch(ClassNotFoundException ex) { return null; }
  
public static ClassPath.ClassFilelookupClassFile(java.lang.String class_name)

return
class file object for given Java class.

    try {
      return ClassPath.SYSTEM_CLASS_PATH.getClassFile(class_name);
    } catch(IOException e) { return null; }
  
public static voidremoveClass(java.lang.String clazz)
Remove class with given (fully qualified) name from repository.

    _repository.removeClass(_repository.findClass(clazz));
  
public static voidremoveClass(com.sun.org.apache.bcel.internal.classfile.JavaClass clazz)
Remove given class from repository.

    _repository.removeClass(clazz);
  
public static voidsetRepository(com.sun.org.apache.bcel.internal.util.Repository rep)
Set repository instance to be used for class loading

    _repository = rep;