samedi 1 décembre 2018

What pattern name is this?

About the pattern sampled below, do anyone knows it's name or creator? It seem a variation of Builder proposed by GoF.(https://en.wikipedia.org/wiki/Builder_pattern#Java)

I think it achieve the main goal of the GoF pattern with much less code. I saw in some framework and started using it a lot, but can't find it's proporser. Thanks for the help.

 public class User {

        private String name;

        public User name(String name) {
            setName(name);
            return this;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }

Aucun commentaire:

Enregistrer un commentaire