directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ersin Er <ersin...@gmail.com>
Subject Re: Immutable objects, what's best ?
Date Sun, 14 Mar 2010 14:16:21 GMT
The builder will pass all the properties that it "collected" to Entry's
constructor in one-shot when you call build(). So there is not that much
plumbing I see.

And this is a very common pattern. But you may find this complicated still.

On Sun, Mar 14, 2010 at 16:08, Emmanuel L├ęcharny <elecharny@apache.org>wrote:

> On 3/14/10 2:56 PM, Ersin Er wrote:
>
>> You might consider builder pattern with a DSL like syntax:
>>
>> Entry entry = new EntryBuilder().add("objectClass", "top").build();
>>
>> where Entry is immutable.
>>
>>
> That means you have to use a factory to build an entry, and that this
> factory returns a mutable object. To get an immutable object out of it, you
> have to call a third method.
>
> Isn't it a bit too complicated ? (even if we don't consider the last method
> to create a immutable object).
>
>
>
> --
> Regards,
> Cordialement,
> Emmanuel L├ęcharny
> www.nextury.com
>
>
>


-- 
Ersin ER
http://www.ersiner.net

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message