use of org.beetl.core.parser.BeetlParser.TypeArgumentContext in project beetl2.0 by javamonkey.
the class AntlrProgramBuilder method getClassType.
private Type getClassType(ClassOrInterfaceTypeContext ctx) {
List<TerminalNode> list = ctx.Identifier1();
String className = this.getID(list);
Class cls = gt.loadClassBySimpleName(className);
if (cls == null) {
BeetlException ex = new BeetlException(BeetlException.TYPE_SEARCH_ERROR, className);
ex.pushToken(this.getBTToken(ctx.getStart()));
throw ex;
}
Type classType = new Type(cls);
TypeArgumentsContext typeArgCtx = ctx.typeArguments();
if (typeArgCtx != null) {
List<TypeArgumentContext> listType = typeArgCtx.typeArgument();
if (listType != null) {
Type[] subType = new Type[listType.size()];
int i = 0;
for (TypeArgumentContext typeCtx : listType) {
ClassOrInterfaceTypeContext child = typeCtx.classOrInterfaceType();
Type type = this.getClassType(child);
subType[i++] = type;
}
classType.types = subType;
}
}
return classType;
}
Aggregations