abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Koch <tho...@koch.ro>
Subject Rename Genarators to Builders?
Date Tue, 24 Jan 2012 15:04:37 GMT
Hi,

I've seen that abdera2 seems to have introduced the Builder pattern for some 
classes, e.g. org.apache.abdera2.common.protocol.BasicWorkspaceInfo in 
common/.
However the Builder is called Generator which at first sight confused me a 
little. I know this thing as Builder Pattern[1] and it's also called Builder 
in Guava, e.g. ImmutableList.Builder().
I think it wouldn't be much work to rename it? May I?

[1] http://en.wikipedia.org/wiki/Builder_pattern

Why does the Generator implement Supplier? I see that the get() method of 
supplier shares a lot of similarity to the build() method of a builder but it 
is semantically different, IMHO.

A Supplier is meant to be given to other parts of the code and expected to be 
thread safe. A Builder is rather used locally and immediately discarded once 
the object has been built.

We could introduce a Builder<T> interface if there's a need for it and one 
could even provide an Adapter that takes a Builder and exposes the Supplier 
interfaces.

Best regards,

Thomas Koch, http://www.koch.ro

Mime
View raw message