Re: jdbc xa patches

Поиск
Список
Период
Сортировка
От Vadim Nasardinov
Тема Re: jdbc xa patches
Дата
Msg-id 200507271900.39224.vadimn@redhat.com
обсуждение исходный текст
Ответ на Re: jdbc xa patches  (Oliver Jowett <oliver@opencloud.com>)
Ответы Re: jdbc xa patches  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
On Wednesday 27 July 2005 18:37, Oliver Jowett wrote:
> >   http://www.google.com/search?q=Java+typesafe+enum
>
> Shrug, the main reason for an enum-like pattern is to get type
> safety, but in this case there's only one field that ever uses the
> enum (and it's never passed around as a parameter), so there's not
> much scope for getting it wrong.

Sure, you can get it right without the added benefit of type safety,
given that the offending piece of code is completely isolated within a
single file.  (Both TransactionState and ResourceAssociationState are
private inner classes of PGXAResource.)  It's a matter of taste and I
have no vested interest in the outcome of this particular
mini-discussion.

That said, from my cursory reading of
org/postgresql/xa/PGXAResource.java, it seems to me that both
TransactionState and ResourceAssociationState instances are used as
values in a Map.  If we replace these two classes with "bare ints"
without changing the rest of the code drastically, we will have to box
those ints into Integers or suchlike before putting them into their
respective maps.  It's not then a huge leap to turn those Integers
into proper typesafe enums, as is currently done.  Seems very
reasonable to me, when viewed on its own merits.  If, however, this
goes against some established pgjdbc prejudice against typesafe enums,
then sure, nuke it.  Better be globally consistent, than locally
correct.

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Date problem on Aix jdk1.4.1
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: jdbc xa patches