From: Alistair Y. <ali...@sm...> - 2006-03-21 17:12:56
|
Bodders, I've been delurked, damn, to ask opinions. We have a requirement for My Modules, which is specific to us so we don't want to pollute Facility. However, a template must call facility to get i= t to write stuff to the screen. The writing is delegated to another class which is currently in org.bodington.contrib on our HEAD but Facility still needs to know about the class to delegate to it - it has to cast to call methods etc, so it has to know about the specific class. A better way would be to define, e.g. package org.bodington.contrib; public interface Plugin { public void run(Request req, PrintWriter writer) throws SomeOrribleException; } then our class could implement Plugin and Facility would only have to loa= d it via Class.forName as a Plugin and call it's run method. It reduces the code in Facility and brings a sort of IOC/dependancy injection to Facility. What would be even better though is allowing templates to call whatever class they wanted and not just Facility or a subclass thereof. Any opinions on org.bodington.contrib.Plugin interface? --=20 Alistair Young Senior Software Engineer UHI@Sabhal M=F2r Ostaig Isle of Skye Scotland |