[RFC][plugin]: make PluginObjectStore a singleton.
Denis Lila
dlila at redhat.com
Thu Mar 31 14:04:50 PDT 2011
> Being at home, I do have my copy with me and it says (in bold type):
>
> 'a single-element enum type is the best way to implement a singleton'.
>
> What Deepak says is true, and there are also benefits for
> serialization too.
Less importantly, enums also prevent any cloneable business.
> It initially seemed odd to me too, but I'm fine with it. I would cite
> the reference, which is:
>
> Bloch, Joshua. Effective Java, 2nd Edition. Item 3, Chapter 2. ISBN:
> 0-321-35668-3.
Good idea. Done.
Regards,
Denis.
----- Original Message -----
> On 15:32 Thu 31 Mar , Deepak Bhole wrote:
> > * Denis Lila <dlila at redhat.com> [2011-03-31 15:29]:
> > >
> > > > I particularly like this comment ;) Do you have a source for
> > > > this? I
> > > > would prefer it if this was an actual class. It's not
> > > > behaviourally an
> > > > enum, so it should not be marked as such.
> > >
> > > Effective Java, second edition.
> > > I don't have the book with me, and I forget what Joshua Bloch's
> > > arguments for enum singletons were (except for how much easier
> > > the singleton property is to enfoce (which is more than enough
> > > of a reason by itself, but there were others)), but they were
> > > very good ones.
> > >
> >
> > I've read this before too. The top things if I recall correctly are
> > that
> > an enum cannot be constructed, not even via reflection and it is
> > implicitly final.
> >
>
>
> > Cheers,
> > Deepak
> >
>
> --
> Andrew :)
>
> Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
>
> Support Free Java!
> Contribute to GNU Classpath and IcedTea
> http://www.gnu.org/software/classpath
> http://icedtea.classpath.org
> PGP Key: F5862A37 (https://keys.indymedia.org/)
> Fingerprint = EA30 D855 D50F 90CD F54D 0698 0713 C3ED F586 2A37
More information about the distro-pkg-dev
mailing list