Re: [jgroups-users] Getters and setters in 4.0

Questions/problems related to using JGroups <[email protected]>
Newsgroups gmane.comp.java.javagroups.general
Message-ID <CAB1b6fHUwX5wxEpEQoHJpd6n2eMvmKixuRn_7UataZyxMH3fKg@mail.gmail.com>
Hi, Bela!

In java-style API widely used a builder pattern for getting a fluent
interface in the object construction. I'd expected to see something like
this:

JChannel = new JChannelBuilder(required config param)
   .setDiscardOwnMessages(true)
   .setName(name)
   ...
   .build();

Another option here is an immutability of jchannel internals.

On Thu, Jul 7, 2016 at 6:58 PM, Questions/problems related to using JGroups
<[email protected]> wrote:

> I'm thinking of changing getters and setters in public classes in 4.0, e.g.
>
> JChannel:
> - Address getAddress() -> Address address()
> - String getName() -> String name()
> - JChannel setName(String name) -> JChannel name(String name)
>
> Message:
> - Address getDest() -> Address dest()
> - Message setDest(Address d) -> Message dest(Address d)
>
>
> This basically removes the 'get' and 'set' prefix, plus setters always
> return the current class, so they can be chained (fluent API).
>
> Currently, we have a mix of old-style and new-style getters/setters, and
> I want to be consistent in all public APIs.
>
> The only downside I can see is that when browsing a class, one doesn't
> immediately see all getters and setters in one place.
>
> I know that this is largely a matter of taste, but I do like the shorter
> names...
>
> Comments, thoughts?
>
> --
> Bela Ban, JGroups lead (http://www.jgroups.org)
>
>
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> javagroups-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javagroups-users
>

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

_______________________________________________
javagroups-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javagroups-users
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.