}
if (internalType instanceof PrimitiveType) {
final PrimitiveType pt = (PrimitiveType) internalType;
if (pt.getType().equals(Primitive.Boolean)) {
return new JavaType(Boolean.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Char)) {
return new JavaType(Character.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Byte)) {
return new JavaType(Byte.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Short)) {
return new JavaType(Short.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Int)) {
return new JavaType(Integer.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Long)) {
return new JavaType(Long.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Float)) {
return new JavaType(Float.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
if (pt.getType().equals(Primitive.Double)) {
return new JavaType(Double.class.getName(), array,
DataType.PRIMITIVE, null, null);
}
throw new IllegalStateException("Unsupported primitive '"
+ pt.getType() + "'");
}
if (internalType instanceof WildcardType) {
// We only provide very primitive support for wildcard types; Roo
// only needs metadata at the end of the day,
// not complete binding support from an AST
final WildcardType wt = (WildcardType) internalType;
if (wt.getSuper() != null) {
final ReferenceType rt = wt.getSuper();
final ClassOrInterfaceType cit = (ClassOrInterfaceType) rt
.getType();
final JavaType effectiveType = getJavaTypeNow(
compilationUnitServices, cit, typeParameters);
return new JavaType(effectiveType.getFullyQualifiedTypeName(),
rt.getArrayCount(), effectiveType.getDataType(),
JavaType.WILDCARD_SUPER, effectiveType.getParameters());
}
else if (wt.getExtends() != null) {
final ReferenceType rt = wt.getExtends();
final ClassOrInterfaceType cit = (ClassOrInterfaceType) rt
.getType();
final JavaType effectiveType = getJavaTypeNow(
compilationUnitServices, cit, typeParameters);
return new JavaType(effectiveType.getFullyQualifiedTypeName(),
rt.getArrayCount(), effectiveType.getDataType(),
JavaType.WILDCARD_EXTENDS,
effectiveType.getParameters());
}
else {
return new JavaType(OBJECT.getFullyQualifiedTypeName(), 0,
DataType.TYPE, JavaType.WILDCARD_NEITHER, null);
}
}
ClassOrInterfaceType cit;
if (internalType instanceof ClassOrInterfaceType) {
cit = (ClassOrInterfaceType) internalType;
}
else if (internalType instanceof ReferenceType) {
cit = (ClassOrInterfaceType) ((ReferenceType) type).getType();
}
else {
throw new IllegalStateException("The presented type '"
+ internalType.getClass() + "' with value '" + internalType
+ "' is unsupported by JavaParserUtils");
}
final JavaType effectiveType = getJavaTypeNow(compilationUnitServices,
cit, typeParameters);
if (array > 0) {
return new JavaType(effectiveType.getFullyQualifiedTypeName(),
array, effectiveType.getDataType(),
effectiveType.getArgName(), effectiveType.getParameters());
}
return effectiveType;
}