コード例 #1
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;
   }
 }
コード例 #2
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;
    }
  }