Re: Why are the header classes final?

"Jeroen van Bemmel" <[email protected]>
Newsgroups gmane.comp.voip.nist-sip
Message-ID <000a01c709ce$4e8c02a0$0601a8c0@BEMBUSTER>
David,

The whole idea behind JAIN SIP is that you get a standardized API, which 
different providers can implement. What you want to do is just not the way 
things were intended to be used, everything under gov.nist.* is "under the 
hood"; as an application programmer you shouldn't need to even look at that 
code.

If you subclass implementation classes, you tie your application to a 
particular stack implementation. While you are right that it would not 
result in ClassCastExceptions, and you are of course free to do as you 
please, don't expect support for it (e.g. in the form of code changes, like 
removing 'final').

Did you try my suggestion, i.e. headerFactory.createHeader( "Contact", " 
magic string <sip:etc>" ) ?

Regards,
Jeroen

[email protected] wrote:
> On Thu, 9 Nov 2006 at 07:56, Jeroen van Bemmel wrote:
>> final helps improve performance, and it also helps us to detect when
>> people
>
>> From everything I've read about this sounds like that is not true
> except in very restricted cases.
>
>> are trying to do things that they shouldn't (no offence). Trying to
>> add a
>
> Um.  Don't I get to decide what I want to do?  I thought open source
> software was about freedom :) :)
>
> Seriously, though, I really don't understand why subclassing a header
> class is something I shouldn't do.  Can someone explain?
>
>> subclassed header to a message will possibly give
>> ClassCastExceptions. It
>
> Is this something intrinsic to Java?  I'm used to python, where if I
> create a subclass, the subclass instances can be used anywhere the
> superclass could be unless the programmer works hard to make it
> otherwise.
>
>> would actually be better to make all header implementations final
>
> Rats.  That's the opposite of the answer I was hoping to hear. :(
>
> --David
> _______________________________________________
> nist-sip mailing list
> [email protected]
> http://www-x.antd.nist.gov/mailman/listinfo/nist-sip
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.