SpringSource/spring-framework — pull request #266 by marschall (2013-03-24 22:35:50+00:00)
Title: [SPR-10412] Support generics in JmsTemplate

The `#convertAndSend` and `#receiveAndConvert` methods and the
`MessageConverter` interface currently are not type safe. Everywhere
`Object` is passed around casts have to be made.

This pull request tries to address the issue by:

- split `MessageConverter` into two interfaces, `MessageDecoder` and
`MessageEncoder` so that Java 8 lambdas can be used

- add generics to `MessageConverter`, `MessageDecoder` and
`MessageEncoder`

- for every `#convertAndSend` method add a new one that has a
`MessageEncoder` as a second argument

- for every `#receiveAndConvert` method add a new one that
has a `MessageDecoder` as a second argument

- add generics to the new `#convertAndSend` and
`#receiveAndConvert` methods

MessageConverter and MessageDecoder are not be best names but the best
ones I could come up with.

Maybe `MessageConverter` and `MessageDecoder` should be annotated with
`java.lang.FunctionalInterface` but this would have to be done over the
entire code base eg. `org.springframework.jdbc.core.RowMapper`.

As usual, I'm not one hundred percent certain when it comes to wild
cards.

And tests are missing.

Issue: SPR-10412
https://jira.springsource.org/browse/SPR-10412