APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal

public abstract Class Repository

extends Object
Class Inheritance
Imports
com.sun.org.apache.bcel.internal.classfile.JavaClass, com.sun.org.apache.bcel.internal.util.SyntheticRepository

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 Also
com.sun.org.apache.bcel.internal.util.Repository, SyntheticRepository

Field Summary

Modifier and TypeField and Description
private static Repository

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static JavaClass

Returns:

old entry in repository
addClass
(final JavaClass clazz)

Adds clazz to repository if there isn't an equally named class already in there.

public static void
clearCache()

Clears the repository.

public static JavaClass[]
getInterfaces(final JavaClass clazz)

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

public static JavaClass[]
getInterfaces(final String className)

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

public static Repository
getRepository()

Returns: currently used repository instance

public static JavaClass[]
getSuperClasses(final JavaClass clazz)

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

public static JavaClass[]
getSuperClasses(final String className)

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

public static boolean
implementationOf(final JavaClass clazz, final JavaClass inter)

Returns: true, if clazz is an implementation of interface inter

public static boolean
implementationOf(final JavaClass clazz, final String inter)

Returns: true, if clazz is an implementation of interface inter

public static boolean
implementationOf(final String clazz, final JavaClass inter)

Returns: true, if clazz is an implementation of interface inter

public static boolean
implementationOf(final String clazz, final String inter)

Returns: true, if clazz is an implementation of interface inter

public static boolean

Returns:

true, if clazz is an instance of superclass
instanceOf
(final JavaClass clazz, final JavaClass superclass)

Equivalent to runtime "instanceof" operator.

public static boolean
instanceOf(final JavaClass clazz, final String superclass)

Returns: true, if clazz is an instance of superclass

public static boolean
instanceOf(final String clazz, final JavaClass superclass)

Returns: true, if clazz is an instance of superclass

public static boolean
instanceOf(final String clazz, final String superclass)

Returns: true, if clazz is an instance of superclass

public static JavaClass

Returns:

JavaClass object for given runtime class
lookupClass
(final Class<?> clazz)

Tries to find class source using the internal repository instance.

public static JavaClass

Returns:

class object for given fully qualified class name
lookupClass
(final String className)

Lookups class somewhere found on your CLASSPATH, or whereever the repository instance looks for it.

public static void
removeClass(final JavaClass clazz)

Removes given class from repository.

public static void
removeClass(final String clazz)

Removes class with given (fully qualified) name from repository.

public static void
setRepository(final Repository rep)

Sets repository instance to be used for class loading

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

repositoryback to summary
private static Repository repository

Constructor Detail

Repositoryback to summary
public Repository()

Method Detail

addClassback to summary
public static JavaClass addClass(final JavaClass clazz)

Adds clazz to repository if there isn't an equally named class already in there.

Returns:JavaClass

old entry in repository

clearCacheback to summary
public static void clearCache()

Clears the repository.

getInterfacesback to summary
public static JavaClass[] getInterfaces(final JavaClass clazz) throws ClassNotFoundException
Returns:JavaClass[]

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).

Exceptions
ClassNotFoundException:
if any of the class's superclasses or superinterfaces can't be found
getInterfacesback to summary
public static JavaClass[] getInterfaces(final String className) throws ClassNotFoundException
Returns:JavaClass[]

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

Exceptions
ClassNotFoundException:
if the named class can't be found, or if any of its superclasses or superinterfaces can't be found
getRepositoryback to summary
public static Repository getRepository()
Returns:Repository

currently used repository instance

getSuperClassesback to summary
public static JavaClass[] getSuperClasses(final JavaClass clazz) throws ClassNotFoundException
Returns:JavaClass[]

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

Exceptions
ClassNotFoundException:
if any of the superclasses can't be found
getSuperClassesback to summary
public static JavaClass[] getSuperClasses(final String className) throws ClassNotFoundException
Returns:JavaClass[]

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

Exceptions
ClassNotFoundException:
if the named class or any of its superclasses can't be found
implementationOfback to summary
public static boolean implementationOf(final JavaClass clazz, final JavaClass inter) throws ClassNotFoundException
Returns:boolean

true, if clazz is an implementation of interface inter

Exceptions
ClassNotFoundException:
if any superclasses or superinterfaces of clazz can't be found
implementationOfback to summary
public static boolean implementationOf(final JavaClass clazz, final String inter) throws ClassNotFoundException
Returns:boolean

true, if clazz is an implementation of interface inter

Exceptions
ClassNotFoundException:
if inter or any superclasses or superinterfaces of clazz can't be found
implementationOfback to summary
public static boolean implementationOf(final String clazz, final JavaClass inter) throws ClassNotFoundException
Returns:boolean

true, if clazz is an implementation of interface inter

Exceptions
ClassNotFoundException:
if clazz or any superclasses or superinterfaces of clazz can't be found
implementationOfback to summary
public static boolean implementationOf(final String clazz, final String inter) throws ClassNotFoundException
Returns:boolean

true, if clazz is an implementation of interface inter

Exceptions
ClassNotFoundException:
if clazz, inter, or any superclasses or superinterfaces of clazz can't be found
instanceOfback to summary
public static boolean instanceOf(final JavaClass clazz, final JavaClass superclass) throws ClassNotFoundException

Equivalent to runtime "instanceof" operator.

Returns:boolean

true, if clazz is an instance of superclass

Exceptions
ClassNotFoundException:
if any superclasses or superinterfaces of clazz can't be found
instanceOfback to summary
public static boolean instanceOf(final JavaClass clazz, final String superclass) throws ClassNotFoundException
Returns:boolean

true, if clazz is an instance of superclass

Exceptions
ClassNotFoundException:
if superclass can't be found
instanceOfback to summary
public static boolean instanceOf(final String clazz, final JavaClass superclass) throws ClassNotFoundException
Returns:boolean

true, if clazz is an instance of superclass

Exceptions
ClassNotFoundException:
if clazz can't be found
instanceOfback to summary
public static boolean instanceOf(final String clazz, final String superclass) throws ClassNotFoundException
Returns:boolean

true, if clazz is an instance of superclass

Exceptions
ClassNotFoundException:
if either clazz or superclass can't be found
lookupClassback to summary
public static JavaClass lookupClass(final Class<?> clazz) throws ClassNotFoundException

Tries to find class source using the internal repository instance.

Returns:JavaClass

JavaClass object for given runtime class

Exceptions
ClassNotFoundException:
if the class could not be found or parsed correctly
See Also
Class
lookupClassback to summary
public static JavaClass lookupClass(final String className) throws ClassNotFoundException

Lookups class somewhere found on your CLASSPATH, or whereever the repository instance looks for it.

Returns:JavaClass

class object for given fully qualified class name

Exceptions
ClassNotFoundException:
if the class could not be found or parsed correctly
removeClassback to summary
public static void removeClass(final JavaClass clazz)

Removes given class from repository.

removeClassback to summary
public static void removeClass(final String clazz)

Removes class with given (fully qualified) name from repository.

setRepositoryback to summary
public static void setRepository(final Repository rep)

Sets repository instance to be used for class loading