I'm trying to load jsonObjects into object entities from a REST responses but when I try to cast the abstract object array into real objects I get the exception: EntityAbstract[] cannot be cast to Feed[]
Feed
extends EntityAbstract
so they are in the same family, and when I debug the returning entities they are instances of Feed, and not EntityAbstract - so I don't see why I'm not allowed to do the cast.
This is the cast method declaration (returning value)
public EntityAbstract[] fetchEntities (Class entityClass) throws Exception
{}
And when I retreive the entities I try to;
for (Feed feed : (Feed[]) ((NewsService) service).getResponse().fetchEntities(Feed.class))
{}
And this throws the exception. What am I supposed to do in order to hint the correct returning array?