예제 #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;
    }
  }
예제 #2
0
 /** Remove class with given (fully qualified) name from repository. */
 public static void removeClass(String clazz) {
   _repository.removeClass(_repository.findClass(clazz));
 }
예제 #3
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;
 }