Thilo Goetz wrote:
> Jörn Kottmann wrote:
>   
>> Thilo Goetz wrote:
>>     
>>> Jörn Kottmann wrote:
>>>  
>>>       
>>>> Jörn Kottmann wrote:
>>>>    
>>>>         
>>>>> Jörn Kottmann wrote:
>>>>>      
>>>>>           
>>>>>> Jörn Kottmann wrote:
>>>>>>        
>>>>>>             
>>>>>>> Hi,
>>>>>>>
>>>>>>> after all the discussion we had I think thats the correct
>>>>>>> way to generify FSIndexRepository:
>>>>>>>
>>>>>>> interface FSIndexRepository {
>>>>>>> FSIndex<FeatureStructure> getIndex(String label);
>>>>>>> FSIterator<FeatureStructure> getAllIndexedFS(Type aType);
>>>>>>> ...
>>>>>>> }
>>>>>>>           
>>>>>>>               
>>>>>> It generified now and also getIndexes:
>>>>>> Iterator<FSIndex<FeatureStructure>> getIndexes();
>>>>>>         
>>>>>>             
>>>>> Stupid question, but how can a FSIndex<FeatureStructure> be converted
>>>>> into a FSIndex<AnnotationFS> ?  Since casting directy is not possible,
>>>>> do I need to write some kind of adapter which does the casting for me ?
>>>>>       
>>>>>           
>>>> FSIndex<FeatureStruture> indexFS
>>>> FSIndex<AnnotationFS> indexAnnotationFS = (FSIndex<AnnotationFS>)
>>>> (Object) indexFS;
>>>>
>>>> Could it be done like this ?
>>>>
>>>> Jörn
>>>>     
>>>>         
>>> Yes, and it's an excellent example of how screwed up Java
>>> generics are.  BTW, I recommend whatever Angelika Langer
>>> has to say on the topic:
>>> http://www.angelikalanger.com/Articles/Topics.html#JAVA
>>> Some of it is only available in German, but she has English
>>> translations for most of her articles.  She calls this a
>>> "double-fisted cast".
>>>   
>>>       
>> Could not find the part where she talks about double fisted casts
>> and googling for it was not successful also.
>>
>> Do you have a link ?
>>     
>
> http://www.angelikalanger.com/Articles/JavaMagazin/Generics/GenericsPart2.html
>
> This one's in German, didn't check if there's an English version.
>   

A mostly ok version can be found by googling "double-fisted cast" and in
the hit list (it's the 4th item), clicking "translate this page" - for
people in some geographies.
Or, just go to http://translate.google.com and put in the url.
-Marshall
>   
>> Jörn
>>
>>     
>
>
>   

Reply via email to