Ejemplo n.º 1
0
  /**
   * 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;
    }
  }
Ejemplo n.º 2
0
 /**
  * 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;
   }
 }
Ejemplo n.º 3
0
 /** Remove given class from repository. */
 public static void removeClass(JavaClass clazz) {
   _repository.removeClass(clazz);
 }
Ejemplo n.º 4
0
 /** Remove class with given (fully qualified) name from repository. */
 public static void removeClass(String clazz) {
   _repository.removeClass(_repository.findClass(clazz));
 }
Ejemplo n.º 5
0
 /**
  * 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;
 }
Ejemplo n.º 6
0
 /** Clear the repository. */
 public static void clearCache() {
   _repository.clear();
 }