jsr343-experts@jms-spec.java.net

[jsr343-experts] (JMS_SPEC-4) Properties on Messages should follow builder pattern.

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Wed, 04 Apr 2012 15:28:23 +0100

Back in May last year, user "genomeprjct" proposed this JIRA issue:

http://java.net/jira/browse/JMS_SPEC-4

"Currently, methods such as javax.jms.Message.setBoolean return void. However, in recent years the builder pattern has
grown in adoption, allowing developers to chain method calls by having the method return the object that the method was
performed upon. If the property methods return these objects, then the code would look much cleaner."

I propose to reject this. Although the builder pattern is an established design pattern, the JMS API was defined a long
time ago and adding new methods at this stage would simply be undesirable bloat.

Also, it might be argued that if a method such as setBooleanProperty(String name, boolean value) was to return a value,
it should return the previous value of the property, just like the equivalent methods on java.util.Map and
java.util.Property. I think this shows that there is no absolute "correct API style" here, and so we should stick with
what we currently have.

If anyone would like to take issue with this, please do. Otherwise I will close it.

Nigel