@Test public void testGetAstParameterizedTypesWithoutEmptySpace() { Map<String, String> javaTypes = createJavaTypes(); when(dataTypeUtils.getJavaTypes()).thenReturn(javaTypes); String typeName = "de.test.Attribute<String,Integer,Boolean>"; ParameterizedType tp = jdtHelper.getAstParameterizedType(ast, typeName); assertEquals("de.test.Attribute<String,Integer,Boolean>", tp.toString()); }
@SuppressWarnings("unchecked") public ParameterizedType getAstParameterizedType(AST ast, String typeName) { String componentTypeName = StringUtils.substringBefore(typeName, "<"); Type componentType = getAstSimpleType(ast, componentTypeName); ParameterizedType parameterizedType = ast .newParameterizedType(componentType); String paramTypeNames = StringUtils.substringAfter(typeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); String[] parametersAsString = StringUtils.split(paramTypeNames, ","); for (int index = 0; index < parametersAsString.length; index++) { String paramTypeName = parametersAsString[index]; paramTypeName = StringUtils.remove(paramTypeName, ","); paramTypeName = StringUtils.trim(paramTypeName); Type paramType = getChosenType(ast, paramTypeName, paramTypeName, ""); parameterizedType.typeArguments().add(paramType); } return parameterizedType; }
JdtHelper { @SuppressWarnings("unchecked") public ParameterizedType getAstParameterizedType(AST ast, String typeName) { String componentTypeName = StringUtils.substringBefore(typeName, "<"); Type componentType = getAstSimpleType(ast, componentTypeName); ParameterizedType parameterizedType = ast .newParameterizedType(componentType); String paramTypeNames = StringUtils.substringAfter(typeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); String[] parametersAsString = StringUtils.split(paramTypeNames, ","); for (int index = 0; index < parametersAsString.length; index++) { String paramTypeName = parametersAsString[index]; paramTypeName = StringUtils.remove(paramTypeName, ","); paramTypeName = StringUtils.trim(paramTypeName); Type paramType = getChosenType(ast, paramTypeName, paramTypeName, ""); parameterizedType.typeArguments().add(paramType); } return parameterizedType; } }
JdtHelper { @SuppressWarnings("unchecked") public ParameterizedType getAstParameterizedType(AST ast, String typeName) { String componentTypeName = StringUtils.substringBefore(typeName, "<"); Type componentType = getAstSimpleType(ast, componentTypeName); ParameterizedType parameterizedType = ast .newParameterizedType(componentType); String paramTypeNames = StringUtils.substringAfter(typeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); String[] parametersAsString = StringUtils.split(paramTypeNames, ","); for (int index = 0; index < parametersAsString.length; index++) { String paramTypeName = parametersAsString[index]; paramTypeName = StringUtils.remove(paramTypeName, ","); paramTypeName = StringUtils.trim(paramTypeName); Type paramType = getChosenType(ast, paramTypeName, paramTypeName, ""); parameterizedType.typeArguments().add(paramType); } return parameterizedType; }  }
JdtHelper { @SuppressWarnings("unchecked") public ParameterizedType getAstParameterizedType(AST ast, String typeName) { String componentTypeName = StringUtils.substringBefore(typeName, "<"); Type componentType = getAstSimpleType(ast, componentTypeName); ParameterizedType parameterizedType = ast .newParameterizedType(componentType); String paramTypeNames = StringUtils.substringAfter(typeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); String[] parametersAsString = StringUtils.split(paramTypeNames, ","); for (int index = 0; index < parametersAsString.length; index++) { String paramTypeName = parametersAsString[index]; paramTypeName = StringUtils.remove(paramTypeName, ","); paramTypeName = StringUtils.trim(paramTypeName); Type paramType = getChosenType(ast, paramTypeName, paramTypeName, ""); parameterizedType.typeArguments().add(paramType); } return parameterizedType; }  Name createFullQualifiedTypeAsName(AST ast,
			String fullQualifiedUmlTypeName, String sourceDirectoryPackageName); String createFullQualifiedTypeAsString(AST ast,
			String fullQualifiedUmlTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createReturnType(AST ast, AbstractTypeDeclaration td,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); Type getChosenType(AST ast, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createReturnTypeAsCollection(AST ast,
			AbstractTypeDeclaration td, MethodDeclaration md,
			String umlTypeName, String umlQualifiedTypeName,
			String sourceDirectoryPackageName, String collectionTypeConstant); SimpleType getAstSimpleType(AST ast, String typeName); PrimitiveType getAstPrimitiveType(AST ast, String typeName); ArrayType getAstArrayType(AST ast, String typeName); @SuppressWarnings("unchecked") ParameterizedType getAstParameterizedType(AST ast, String typeName); @SuppressWarnings("unchecked") void createParameterTypes(AST ast, AbstractTypeDeclaration td,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String umlPropertyName,
			String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createParameterTypesAsCollection(AST ast,
			AbstractTypeDeclaration td, MethodDeclaration md,
			String umlTypeName, String umlQualifiedTypeName,
			String umlPropertyName, String sourceDirectoryPackageName,
			String collectionTypeConstant); String getClassName(final String fullClassName); }
JdtHelper { @SuppressWarnings("unchecked") public ParameterizedType getAstParameterizedType(AST ast, String typeName) { String componentTypeName = StringUtils.substringBefore(typeName, "<"); Type componentType = getAstSimpleType(ast, componentTypeName); ParameterizedType parameterizedType = ast .newParameterizedType(componentType); String paramTypeNames = StringUtils.substringAfter(typeName, "<"); paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">"); String[] parametersAsString = StringUtils.split(paramTypeNames, ","); for (int index = 0; index < parametersAsString.length; index++) { String paramTypeName = parametersAsString[index]; paramTypeName = StringUtils.remove(paramTypeName, ","); paramTypeName = StringUtils.trim(paramTypeName); Type paramType = getChosenType(ast, paramTypeName, paramTypeName, ""); parameterizedType.typeArguments().add(paramType); } return parameterizedType; }  Name createFullQualifiedTypeAsName(AST ast,
			String fullQualifiedUmlTypeName, String sourceDirectoryPackageName); String createFullQualifiedTypeAsString(AST ast,
			String fullQualifiedUmlTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createReturnType(AST ast, AbstractTypeDeclaration td,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); Type getChosenType(AST ast, String umlTypeName,
			String umlQualifiedTypeName, String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createReturnTypeAsCollection(AST ast,
			AbstractTypeDeclaration td, MethodDeclaration md,
			String umlTypeName, String umlQualifiedTypeName,
			String sourceDirectoryPackageName, String collectionTypeConstant); SimpleType getAstSimpleType(AST ast, String typeName); PrimitiveType getAstPrimitiveType(AST ast, String typeName); ArrayType getAstArrayType(AST ast, String typeName); @SuppressWarnings("unchecked") ParameterizedType getAstParameterizedType(AST ast, String typeName); @SuppressWarnings("unchecked") void createParameterTypes(AST ast, AbstractTypeDeclaration td,
			MethodDeclaration md, String umlTypeName,
			String umlQualifiedTypeName, String umlPropertyName,
			String sourceDirectoryPackageName); @SuppressWarnings("unchecked") void createParameterTypesAsCollection(AST ast,
			AbstractTypeDeclaration td, MethodDeclaration md,
			String umlTypeName, String umlQualifiedTypeName,
			String umlPropertyName, String sourceDirectoryPackageName,
			String collectionTypeConstant); String getClassName(final String fullClassName); static final String JAVA_UTIL_COLLECTION; static final String JAVA_UTIL_LIST; static final String JAVA_UTIL_SET; static final String JAVA_UTIL_SORTEDSET; }