示例#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;
  }
示例#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;
 }
示例#3
0
 public static Class getClassReference(
     Class baseType, TypeDescriptor tDescr, VariableResolverFactory factory, ParserContext ctx)
     throws ClassNotFoundException {
   return findClass(
       factory, repeatChar('[', tDescr.arraySize.length) + "L" + baseType.getName() + ";", ctx);
 }