[aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

Marko Strukelj marko.strukelj at gmail.com
Thu Nov 1 07:55:04 EDT 2012


On Thu, Nov 1, 2012 at 12:49 PM, Matthias Wessendorf <matzew at apache.org> wrote:
> On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <daniel at passos.me> wrote:
>> +1 to pipeline.add(Project.class)
>
> One more thing.. 'pipeline.add(Type.class);' will reflect to the following URL:
> http://BASE_URL/types <<<== note the 's' for plural ....
>

I just wanted to ask about that :)

Maybe we could even introduce an annotation on 'entity' classes that
would specify an endpoint, and take that into account.

> Fluent API:
> the combination of 'add()' and a followed/ending 'build()' makes sense
> in terms of a fluent API:
> - here you add something (-> pipe) that is created (build) at the end
> of the statement...
>
Yes that's nice.

> A little note aside...
>
> Pipeline pipeline  = new Pipeline(ROOT_URL);
> pipeline.pipe(Project.class).endpoint("foo").name("bar").auth(myAuthMod).buildAndAdd();
>
> Is fine for me too:
> -pipe => indicates you create a pipe object;
> -buildAndAdd => you build the object and add it to the pipeline.
>
> Not sure if the 'buildAndAdd' is a bit too verbose.
>
> I am fine with the suggestion from Bruno
> (pipeline.add(class).build();), but wanted to share the notes on the
> pipe().buildAndAdd() as well
>
>
> -M
>
>
>>
>> On Thu, Nov 1, 2012 at 9:03 AM, Bruno Oliveira <bruno at abstractj.org> wrote:
>>>
>>> Good morning everyone! Lay out your costumes from halloween and let's talk
>>> about this jira (https://issues.jboss.org/browse/AEROGEAR-593).
>>>
>>> Passos did a great work creating a builder for Pipes and of course we can
>>> improve it more and more, it's all about software. Currently to create a
>>> Pipe we must do it:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.pipe().name("tasks").useClass(Task.class).buildAndAdd();
>>> pipeline.pipe().name("tags").useClass(Tag.class).buildAndAdd();
>>>
>>> Chatting with Matthias we agreed that would be better 2 alternatives:
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>> pipeline.add(Project.class).build();
>>>
>>> Doing just this implicitly means that the name of the pipe will be
>>> "Project" and if you need 'extras':
>>>
>>> Pipeline pipeline  = new Pipeline(ROOT_URL);
>>>
>>> pipeline.add(Project.class).endpoint("foo").name("bar").auth(myAuthMod).build();
>>>
>>> What do you guys think?
>>>
>>>
>>> --
>>> "The measure of a man is what he does with power" - Plato
>>> -
>>> @abstractj
>>> -
>>> Volenti Nihil Difficile
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> aerogear-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev


More information about the aerogear-dev mailing list