Tuesday, February 14, 2006

More on service lookup helpers

I recently wrote about a JNLP convenience method for looking up JNLP services based on a class literal rather than a string name of class, and handling casting for you with generics rather than having the calling code cast the return. It turns out that Sun has been thinking in that direction already for JDK6 with the java.util.Service class and metadata conventions.

I was fortunate to run across this interesting improvement from a commenter on Bob Lee's blog and his remarks on Spring. Thank you Sam Pullarra for pointing this out. As suggested by the Java generics tutorial, using class literals as type tokens leads to many curious and beneficial paths.

UPDATE: As usual, Erik's linkblog is the place to find great links like this.

No comments: