> > Also, I was wondering what the benefit of having the singleton inside a
> > static inner class is. I've seen the pattern before, but I've never
> > understood the benefit of that over just having the singleton
> > XPathFunctionContext as a private static final in XPathFunctionContext
> > itself.
> 
> You know, it seemed like a good idea at the time, but now I'm having
> trouble remembering why I did it that way.   ;)
> 
> Can anyone else justify my actions?

Actually, I remember now.

If you have 

public class MyClass
{
        private static final MyClass instance = new MyClass();
}

then, whenever MyClass is class-loaded, the singleton will automagically
be instantiated, even if you don't need it.  Using the inner class,
I *think* (I could certainly be wrong; Rusty will correct me if I am)
that it prevents the singleton instance from being constructed unless
you actually ask for it.

        -bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to