Exemplo n.º 1
0
  public static Class getClassReference(ParserContext ctx, TypeDescriptor tDescr)
      throws ClassNotFoundException {
    Class cls;
    if (ctx != null && ctx.hasImport(tDescr.className)) {
      cls = ctx.getImport(tDescr.className);
      if (tDescr.isArray()) {
        cls =
            findClass(
                null, repeatChar('[', tDescr.arraySize.length) + "L" + cls.getName() + ";", ctx);
      }
    } else if (ctx == null && hasContextFreeImport(tDescr.className)) {
      cls = getContextFreeImport(tDescr.className);
      if (tDescr.isArray()) {
        cls =
            findClass(
                null, repeatChar('[', tDescr.arraySize.length) + "L" + cls.getName() + ";", ctx);
      }
    } else {
      cls = createClass(tDescr.getClassName(), ctx);
      if (tDescr.isArray()) {
        cls =
            findClass(
                null, repeatChar('[', tDescr.arraySize.length) + "L" + cls.getName() + ";", ctx);
      }
    }

    return cls;
  }
Exemplo n.º 2
0
 public static Class getClassReference(ParserContext ctx, Class cls, TypeDescriptor tDescr)
     throws ClassNotFoundException {
   if (tDescr.isArray()) {
     cls =
         findClass(
             null, repeatChar('[', tDescr.arraySize.length) + "L" + cls.getName() + ";", ctx);
   }
   return cls;
 }