> IMO, reflection is only appropriate when the name of the class to 
> instantiate is *not* known at compile time. If it is known, then use 
> a constructor.

Right.  When building jaxen.jar, we know of 4 navigators. But someone
might write (much later) a CheeseNavigator that knows how to apply XPaths
to stacks of cheese.  The Class.forName(..) is simply a hack to invoke
the static{} block of the class.  Someone could still explicitly
register the new Navigator using the code that's in the static{} block
directly in client-code.

ie:

        public static void main(String[] args)
        {
                NavigatorRegistrar.register( new CheeseNavigator() );

                ...
        }

This is still only pertinent to the reflection-based choose-a-navigator
stuff we're discussion.  I personally will never use it.

        -bob



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

Reply via email to