uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Kottmann <kottm...@gmail.com>
Subject Re: clarifying a generics issue
Date Tue, 11 Aug 2009 12:17:11 GMT
Marshall Schor wrote:
> I'll probably stop trying to convince others if they continue to feel
> that the tradeoffs here should be in the direction of returning only
> specific types (disallowing users from specifying downcasting in that
> manner), versus using types of the form T extends X,
> which allows users to specify downcasting.
>   
The case of FSIndexRepository is maybe more clear
then the other cases in our API.

With down casting it could be changed to

interface FSIndexRepository {
<T extends FeatureStructure> FSIndex<T> getIndex(String label);
<T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type aType);
...
}

and then a user could write

FSIndex<AnnotationFS> index = repo.getIndex(...);
FSIterator<AnnotationFS> it = repo.getAllIndexedFS(...);

Jörn

Mime
View raw message