1 package org.sapia.magnet.render; 2 3 import org.sapia.util.text.TemplateElementIF; 6 import org.sapia.util.text.TemplateFactory; 7 import org.sapia.util.text.TemplateException; 8 9 10 21 public abstract class AbstractRenderable implements RenderableIF { 22 23 27 28 private TemplateFactory _theTemplateFactory; 29 30 34 37 protected AbstractRenderable() { 38 _theTemplateFactory = new TemplateFactory( 39 TemplateFactory.DEFAULT_STARTING_DELIMITER, TemplateFactory.DEFAULT_ENDING_DELIMITER); 40 } 41 42 46 53 protected String resolveValue(MagnetContext aContext, String aValue) throws RenderingException { 54 try { 55 if (aValue == null) { 56 return null; 57 } else { 58 TemplateElementIF aTemplate = _theTemplateFactory.parse(aValue); 59 return aTemplate.render(aContext); 60 } 61 } catch (TemplateException te) { 62 throw new RenderingException("Unable to resolve the value " + aValue, te); 63 } 64 } 65 66 70 76 public void render(MagnetContext aContext) throws RenderingException { 77 } 78 } 79 | Popular Tags |