On 1 Jan 2003, John Casey wrote:
> >"code-internal constants ... shall always be declared in
> >typesafe-enumeration style classes"
> >
> >well you do know there are issues with deserialization of typesafe
> >enums? ( deser(ser(A))!=A )
>
> Well, actually, simply writing the following snippet will solve that
> problem...
>
> private Object readResolve(){
> return lookupConstant(internalIndex);
> }
>
> where lookupConstant() is an internal private method which finds the
> appropriate constant instance based on an internal index in an internal
> array of the constants.
Extend the Enum class in Commons.Lang to avoid having to think about this.
Even with the readResolve fix, there are still issues with multiple
class-loaders I believe.
Hen
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>