ParseCodeUtils { public static String parseClassName(Type type) { if (type.isSimpleType()) { SimpleType simpleType = (SimpleType)type; return simpleType.getName().getFullyQualifiedName(); } else if (type.isPrimitiveType()) { PrimitiveType primitiveType = (PrimitiveType)type; return primitiveType.getPrimitiveTypeCode().toString(); } else if (type.isParameterizedType()) { ParameterizedType parameterizedType = (ParameterizedType)type; SimpleType simpleType = (SimpleType)parameterizedType.getType(); String simpleTypeName = simpleType.getName().getFullyQualifiedName(); List parameterizedTypeArgumentList = parameterizedType.typeArguments(); if (parameterizedTypeArgumentList.size() == 1) { String argumentClassName = ((SimpleType)parameterizedTypeArgumentList.get(0)).getName().getFullyQualifiedName(); return String.format("%s<%s>", simpleTypeName, argumentClassName); } else { return simpleTypeName; } } else if (type.isArrayType()) { ArrayType arrayType = (ArrayType)type; Type elementType = arrayType.getElementType(); return ParseCodeUtils.parseClassName(elementType) + "[]"; } throw new IllegalArgumentException(String.format("Unsupported org.eclipse.jdt.core.dom.Type class: %s", type.getClass().getName())); }  static int getLineNumber(String sourceCode, BodyDeclaration bodyDeclaration); static String parseClassName(Type type); static void checkClassAndSuperclassNames(String sourceCode);  }
@Test public void parseClassNameTest() { ParseResultStruct build = new ParseResultStruct.Builder(sourceCode).fields().constructors().methods().build(); List<MethodSimpleDeclaration> methods = build.methods; List<SingleVariableDeclaration> methodParams = methods.get(0).getMethodDeclaration().parameters(); methodParams.forEach(methodParam -> { LOGGER.info(build.currentClass); }); }