Example #1
0
 public static String getClassName(Class type) {
   String className = ClassManager.getClassAlias(type);
   if (className == null) {
     className = type.getName().replace('.', '_').replace('$', '_');
     ClassManager.register(type, className);
   }
   return className;
 }
Example #2
0
 private void commandClasspath(StringTokenizer t) {
   if (!t.hasMoreTokens()) {
     out.println(classManager.getClassPath().asString());
   } else {
     // ### Should throw exception for invalid path.
     // ### E.g., vetoable property change.
     classManager.setClassPath(new SearchPath(t.nextToken()));
   }
 }
Example #3
0
 public static Class getClass(String className) {
   if (ClassManager.containsClass(className)) {
     return ClassManager.getClass(className);
   }
   StringBuffer cn = new StringBuffer(className);
   LinkedList al = new LinkedList();
   int p = className.indexOf("_");
   while (p > -1) {
     al.add(HproseHelper.valueOf(p));
     p = className.indexOf("_", p + 1);
   }
   Class type = null;
   if (al.size() > 0) {
     try {
       int size = al.size();
       int[] pos = new int[size];
       int i = 0;
       for (Iterator iter = al.iterator(); iter.hasNext(); i++) {
         pos[i] = ((Integer) iter.next()).intValue();
       }
       type = getClass(cn, pos, 0, '.');
       if (type == null) {
         type = getClass(cn, pos, 0, '_');
       }
       if (type == null) {
         type = getInnerClass(cn, pos, 0, '$');
       }
     } catch (Exception e) {
     }
   } else {
     try {
       type = Class.forName(className);
     } catch (Exception e) {
     }
   }
   ClassManager.register(type, className);
   return type;
 }