if (type != null) {
return type;
}
ITypeDeclaration typeDeclaration = getTypeDeclaration();
type = typeDeclaration.getType();
// For a collection type, return the first type parameter
if (getTypeHelper().isCollectionType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length > 0) {
type = typeParameters[0].getType();
}
}
// For a map type, by default the value is the actual type to return
else if (getTypeHelper().isMapType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length == 2) {
type = typeParameters[1].getType();
}
}