uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-1524) JFSIndexRepository should be enhanced with new generic methods
Date Wed, 07 Sep 2016 13:42:20 GMT

    [ 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)

Mime
View raw message