Thu 1 Sep 2005
Hardcoded Class Names
Posted by dkaz under Java
Instead of hardcoding class names in your Java code (e.g. String clz = “com.foo.ReportFactory”;),
try generating it (e.g. String clz = ReportFactory.class.getName();) - it’s a lot less brittle!

September 2nd, 2005 at 7:27 am
Somethimes, this is even better:
String clz = this.getClass().getName();
Mats
September 2nd, 2005 at 10:40 am
Assuming that “this” points to the class you want
:)