Re: generics: ResourceFactory.produceResource
Adam Lally wrote: On Wed, Aug 19, 2009 at 1:54 PM, Jörn Kottmannkottm...@gmail.com wrote: The current declaration with out generics: public Resource produceResource(Class aResourceClass, ResourceSpecifier aSpecifier, MapString, Object aAdditionalParams) throws ResourceInitializationException; Can it be assumed that aResourceClass is always a class which extends Resource, if so it could be declared as Class? extends Resource. Yes, I think that is right. In CPEFactory a org.apache.uima.collection.base_cpm.BaseCollectionReader is used as a resource class at line 345 to call UIMAFramework.produceResource. BaseCollectionReader does not extends the Resource interface. I wonder if that is correct usage of the produceResource method. Jörn
Re: generics: ResourceFactory.produceResource
On Thu, Aug 20, 2009 at 8:11 AM, Jörn Kottmannkottm...@gmail.com wrote: Adam Lally wrote: On Wed, Aug 19, 2009 at 1:54 PM, Jörn Kottmannkottm...@gmail.com wrote: The current declaration with out generics: public Resource produceResource(Class aResourceClass, ResourceSpecifier aSpecifier, MapString, Object aAdditionalParams) throws ResourceInitializationException; Can it be assumed that aResourceClass is always a class which extends Resource, if so it could be declared as Class? extends Resource. Yes, I think that is right. In CPEFactory a org.apache.uima.collection.base_cpm.BaseCollectionReader is used as a resource class at line 345 to call UIMAFramework.produceResource. BaseCollectionReader does not extends the Resource interface. I wonder if that is correct usage of the produceResource method. That usage doesn't seem quite right. It will only work if the implementation of BaseCollectionReader happens to also implement Resource, otherwise I think it would throw a ClassCastException in produceResource(). I'm in favor of making BaseCollectionReader extend Resource. -Adam
generics: ResourceFactory.produceResource
The current declaration with out generics: public Resource produceResource(Class aResourceClass, ResourceSpecifier aSpecifier, MapString, Object aAdditionalParams) throws ResourceInitializationException; Can it be assumed that aResourceClass is always a class which extends Resource, if so it could be declared as Class? extends Resource. There are many places where aResourceClass occurs, we should handle them all identical. Jörn
Re: generics: ResourceFactory.produceResource
On Wed, Aug 19, 2009 at 1:54 PM, Jörn Kottmannkottm...@gmail.com wrote: The current declaration with out generics: public Resource produceResource(Class aResourceClass, ResourceSpecifier aSpecifier, MapString, Object aAdditionalParams) throws ResourceInitializationException; Can it be assumed that aResourceClass is always a class which extends Resource, if so it could be declared as Class? extends Resource. Yes, I think that is right. -Adam