Hmm, I *think* it is binary compatible, because T erases to Object on compilation. It wouldn't be source compatible but I would argue any code that fails to compile after making the change is broken and currently exposed to ClassCastExceptions and needs to be fixed.
Cheers. Michael Quilleash Morgan Stanley | Technology 20 Cabot Square | Canary Wharf | Floor 01 London, E14 4QW Phone: +44 20 7677-4543 [EMAIL PROTECTED] -----Original Message----- From: Daniel Kulp [mailto:[EMAIL PROTECTED] Sent: 29 September 2008 15:46 To: Quilleash, Michael (IT) Cc: [email protected] Subject: Re: Message.getContent vs Message.get On Monday 29 September 2008 10:40:43 am Quilleash, Michael (IT) wrote: > Thanks. > > So content would be for things like Streams/XMLReaderWriters/Faults etc. > > Any thoughts on the second part of the e-mail about the generic > type-safety of get/setContent(). Yea. I think I saw that at one point but was concerned if changing it is considered binary compatible or not. I'm not sure if changing it to: setContent(Class<T> format, T content); or similar would cause compilation or runtime problems with previous versions. Dan > > Cheers. > > Michael Quilleash > Morgan Stanley | Technology > 20 Cabot Square | Canary Wharf | Floor 01 London, E14 4QW > Phone: +44 20 7677-4543 > [EMAIL PROTECTED] > > -----Original Message----- > From: Daniel Kulp [mailto:[EMAIL PROTECTED] > Sent: 29 September 2008 14:34 > To: [email protected] > Cc: Quilleash, Michael (IT) > Subject: Re: Message.getContent vs Message.get > > On Saturday 27 September 2008 8:03:25 am Quilleash, Michael (IT) wrote: > > Hi all, > > > > Is there any reason there are two different, but similar in > > functionality, methods on the Message API? > > > > getContent( Class<T> clazz ) and get( Class<T> clazz ) both seem to > > do pretty much the same thing. Just a bit confusing when I > > accidently use them interchangably. > > The content is really the "content" that was transferred. The "get" is > basically a map of properties (litterally, Map<String, Object>) that can be > associated with the message/exchange. Basically, a place for interceptors > to store extra information as the message flows. > > The get(Class<T>) and put(Class<T>,..) methods are just wrappers that do: > this.get(cls.getName()) > type of thing as a convenience. > > Dan > > > I also noticed that setContent doesn't enforce the generic type properly. > > > > <T> void setContent(Class<T> format, Object content); > > <T> T getContent(Class<T> format); Would allow class and object > > types to be incompatible and then a subsequent call to getContent() > > would ClassCastException. > > > > e.g. > > > > // compiles ok > > setContent( XMLStreamReader.class, new Integer( 0 ) ); > > > > // fails at runtime despite generic "safety" > > XMLStreamReader xmlStreamReader = getContent( XMLStreamReader.class > > ); > > > > The get/put pairing enforces this correctly. > > > > Cheers. > > > > Michael Quilleash > > Morgan Stanley | Technology > > 20 Cabot Square | Canary Wharf | Floor 01 London, E14 4QW > > Phone: +44 20 7677-4543 > > > >[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED] > >anle y. com> -------------------------------------------------------- > > > > NOTICE: If received in error, please destroy and notify sender. > > Sender does not intend to waive confidentiality or privilege. Use of > > this email is prohibited when received in error. > > -- > Daniel Kulp > [EMAIL PROTECTED] > http://www.dankulp.com/blog > -------------------------------------------------------- > > NOTICE: If received in error, please destroy and notify sender. Sender > does not intend to waive confidentiality or privilege. Use of this > email is prohibited when received in error. -- Daniel Kulp [EMAIL PROTECTED] http://www.dankulp.com/blog -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
