Re: Changes in the JavaPlatform API

Vitezslav Stejskal <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>

Tomas Zezula wrote:

> Vitezslav Stejskal wrote:
>
>>
>>
>> Tomas Zezula wrote:
>>
>>>>> The question is what to put into base EditionType, according to me 
>>>>> it should have at least SE type.
>>>>>
>> Wouldn't it be enough to use String identification of the platform 
>> instead of introducing special class which is empty anyway and serves 
>> for identification purposes only. It's not clear to me who will use 
>> this identification anyway - PlatformService implementations, the 
>> project when referencing used paltform, ...?
>>
>> [snip]
>
>
>
> I thought about it, but this is not a save way how to do this, the 
> enumeration class, as described in Effective Java, is much more safer 
> and it is
> scallable as well.

OK, this is true when you want to define an enumeration in API and you 
want to force everybody to pass only defined values to your API methods, 
but in this case (if I understand it right) you will allow to subclass 
EditionType and create arbitrary new tag values. This is safe as much as 
using String identification IMO.

>
>>
>>
>>>>>> Another thought -- what all functions will the tag serve for ? 
>>>>>> Isn't "aPlatform instanceof the_edition_specific_subtype" 
>>>>>> expression sufficient to lurk for a specific platform edition ? 
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I don't want to have a test of edition type using instanceof, for 
>>>>> me it seems better to define an explicit method for that.
>>>>
>>>>
>>>>
>> Well, but implementation of PlatformService will have to typecast for 
>> specific platform type anyway if it will want to check additional 
>> parameters like specification version, etc. 
>
>
> Yes, this is true, but sometimes you are just interested in the type 
> of platform and you don't need a cast.
> And API based on instanceof testing does not seems to me very good.

I agree that 'instanceof' testing isn't very nice.
-vita
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.