From: | Russell Francis <rfrancis(at)ev(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Patch to improve Cloneable implementation on classes which extend PGobject. |
Date: | 2007-06-24 16:52:04 |
Message-ID: | 467EA134.6050602@ev.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
The attached patch aims to improve the current implementation of the
clone() method on classes which extend PGobject. I believe that the
current implementation has a few deficiencies, namely
1. They are implemented by calling the objects constructors which means
that each derived class must re-implement all of the logic of the parent
in order to clone itself correctly.
2. When extending an object, the default behavior of the clone() method
is to return an object of the wrong type where most developers expect
that if the derived class is Cloneable and doesn't add any mutable
fields the base classes clone() implementation should suffice in cloning
the object and it should return an object of the same type as the
derived class.
I think that this patch provides implementations of the clone() method
which falls more in line with the behavior that most developers expect
from the method. Thanks for considering the patch for inclusion in the
driver. If you have any questions or problems with it, please feel free
to ask.
Sincerely,
Russ Francis
Attachment | Content-Type | Size |
---|---|---|
cloneable.diff | text/x-patch | 8.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-06-25 04:15:59 | Re: Status of binary protocol usage? |
Previous Message | aaime74 | 2007-06-24 16:21:56 | Re: Status of binary protocol usage? |