Sorry Guys,

I did not pay attention to that. Actually when I said +1 I wanted to say +1 to pipeline.pipe(Class) and not to pipeline.add(Class) 

using pipeline.pipe(Project.class).buildAndAdd() you don't need to specify mandatory "name" and "class" to call buildAndAdd() 

The way I see, it's less effort to do, so wdyt?

https://gist.github.com/3973193

On Thu, Nov 1, 2012 at 10:48 AM, Summers Pittman <supittma@redhat.com> wrote:
-1 to Pipeline.add
+1 to Pipline.pipe w/ buildAndAdd() (or overloading build to also add)

I don't like pipeline.add(Class) because it implies that the adding is happening then and you don't have to do more work.  I like buildAndAdd or overloading the builder Pipeline provides because it is either more explicit or more automatic respectivly.

----- Original Message -----
From: "Matthias Wessendorf" <matzew@apache.org>
To: "AeroGear Developer Mailing List" <aerogear-dev@lists.jboss.org>
Sent: Thursday, November 1, 2012 7:49:11 AM
Subject: Re: [aerogear-dev] AEROGEAR-593 - Builder pattern isn't consistent

On Thu, Nov 1, 2012 at 12:15 PM, Daniel Passos <daniel@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 ....

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...

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@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@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev