/** * 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 */ public static JavaClass lookupClass(String class_name) { try { JavaClass clazz = _repository.findClass(class_name); if (clazz == null) { return _repository.loadClass(class_name); } else { return clazz; } } catch (ClassNotFoundException ex) { return null; } }
/** * Try to find class source via getResourceAsStream(). * * @see Class * @return JavaClass object for given runtime class */ public static JavaClass lookupClass(Class clazz) { try { return _repository.loadClass(clazz); } catch (ClassNotFoundException ex) { return null; } }
/** Remove given class from repository. */ public static void removeClass(JavaClass clazz) { _repository.removeClass(clazz); }
/** Remove class with given (fully qualified) name from repository. */ public static void removeClass(String clazz) { _repository.removeClass(_repository.findClass(clazz)); }
/** * Add clazz to repository if there isn't an equally named class already in there. * * @return old entry in repository */ public static JavaClass addClass(JavaClass clazz) { JavaClass old = _repository.findClass(clazz.getClassName()); _repository.storeClass(clazz); return old; }
/** Clear the repository. */ public static void clearCache() { _repository.clear(); }