[
https://issues.apache.org/jira/browse/UIMA-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15470677#comment-15470677
]
Marshall Schor commented on UIMA-1524:
--------------------------------------
A small part of this is done. See for instance: JCasImpl:
getAllIndexedFS(Class<T> clazz).
Also, there are some kinds of APIs which are set up to take the usage context
definition of the type. e.g. JFSIndexRepository's:
{code:java}
public <T extends Annotation> AnnotationIndex<T> getAnnotationIndex(int type)
{code}
If this is used in a context where MyType is a type which extends Annotation,
then
{code:java}
AnnotationIndex<MyType> myIndex = myJfsIndexRepo.getAnnotationIndex(MyType.type)
{code}
works, where the type "MyType" comes from the receiving argument.
It would be easy to extend things like this to have, instead of arguments like
MyType.type, arguments of MyType.class. which then could provide more
compile-time checking.
> JFSIndexRepository should be enhanced with new generic methods
> --------------------------------------------------------------
>
> Key: UIMA-1524
> URL: https://issues.apache.org/jira/browse/UIMA-1524
> Project: UIMA
> Issue Type: Improvement
> Components: Core Java Framework
> Affects Versions: 2.3
> Reporter: Joern Kottmann
>
> Existing methods should be overloaded with an additional Class argument to
> specify the exact return type. This changes make down casting of returned
> objects unnecessary.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)