* {@inheritDoc}
*/
@Override
protected IType resolveType() {
TypeHelper typeHelper = getTypeHelper();
ITypeDeclaration typeDeclaration = getTypeDeclaration();
IType type = typeDeclaration.getType();
// For a collection type, return the first type parameter
if (typeHelper.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 (typeHelper.isMapType(type)) {
ITypeDeclaration[] typeParameters = typeDeclaration.getTypeParameters();
if (typeParameters.length == 2) {
type = typeParameters[1].getType();
}
}
// A collection-valued path expression should not reference a primitive,
// however, in an invalid query, this could potentially happen and the API
// only deals with the primitive wrapper type
return typeHelper.convertPrimitive(type);
}