Exemplo n.º 1
0
  /**
   * Needed to convert java style class names to classloaded class names. From: java.lang.String[]
   * To: [Ljava.lang.String;
   *
   * @param javaStyle Description of the Parameter
   * @return Description of the Return Value
   */
  private String transJavaToClass(String javaStyle) {
    String className = javaStyle;

    int arrayCount = 0;
    while (className.endsWith("[]")) {
      // Counts how may arrays are in this class name
      arrayCount++;
      className = className.substring(0, className.length() - 2);
    }

    // No array around, nothing to do.
    if (arrayCount <= 0) {
      return className;
    }

    String replace = (String) primiMap.get(className);

    // If I can substitute the name I will do it
    if (replace != null) {
      className = replace;
    } else {
      className = "L" + className + ";";
    }

    while (arrayCount-- > 0) {
      className = "[" + className;
    }

    return className;
  }
Exemplo n.º 2
0
 static {
   // This will be executed once when this class is loaded
   primiMap = new HashMap<String, String>();
   primiMap.put("boolean", "Z");
   primiMap.put("byte", "B");
   primiMap.put("short", "S");
   primiMap.put("char", "C");
   primiMap.put("int", "I");
   primiMap.put("long", "J");
   primiMap.put("float", "F");
   primiMap.put("double", "D");
 }