package pt.ist.renderers.utils; import java.util.Properties; import pt.ist.renderers.Renderer; /** * RendererDescription is used to mantain the renderer's class and the default * properties associated with that particular renderer. * * @author cfgi */ public class RendererDescription { private Class renderer; private Properties properties; public RendererDescription(Class renderer, Properties defaultProperties) { this.renderer = renderer; this.properties = defaultProperties; } public Properties getProperties() { return properties; } public Class getRenderer() { return renderer; } public Renderer createRenderer() { Renderer renderer = null; try { renderer = getRenderer().newInstance(); if (properties != null) { RenderUtils.setProperties(renderer, properties); } } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return renderer; } }