tag:blogger.com,1999:blog-8155967785119627415.post7617355945577989552..comments2024-03-05T06:36:34.384+01:00Comments on Java EE Notes: Configurable, and modular Java classes using Annotations and EnumerationsAnonymoushttp://www.blogger.com/profile/04721126777112597217noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8155967785119627415.post-81833539058790146142012-05-21T10:59:25.928+02:002012-05-21T10:59:25.928+02:00You can use the class name to do that, but I'v...You can use the class name to do that, but I've chosen this way because of the following reasons:<br />- I want to decouple the implementation name from the logical parameter name. In a real case, the module name is a more 'end user friendly' name, and it's saved in the database. This way I can easily change the implementation if needed.<br />- I always try to avoid building the fully qualified name using Strings, because you have to hardcode the package name somewhere or there is other boilerplate code necessary to find out the package name.Anonymoushttps://www.blogger.com/profile/04721126777112597217noreply@blogger.comtag:blogger.com,1999:blog-8155967785119627415.post-20036391048410595262012-05-19T06:00:02.092+02:002012-05-19T06:00:02.092+02:00Hello:
For translate the class name to the actual...Hello:<br /><br />For translate the class name to the actual class in the factory why don't you use Class.forName() and inside the ModuleFactoryImpl().getModule() implementation you can concatenate the module name with the package info in order to get the fully qualified name.Giovanny Velezhttps://www.blogger.com/profile/09354299401367435457noreply@blogger.com