01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ValueRenderer.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.template;
09:
10: /**
11: * An object which can render content for a value in a template. To use a
12: * renderer in a template, the template should contain a value with an ID like
13: * <code>"RENDER:org.rifers.something.MyRenderer"</code>, where
14: * <code>MyRenderer</code> is your <code>ValueRenderer</code> class.
15: * <p>Value renderer implementations must provide a public zero-argumnet
16: * no-arg constructor.
17: *
18: * @author Keith Lea <keith[remove] at cs dot oswego dot edu>
19: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
20: * @version $Revision: 3634 $
21: * @since 1.0
22: */
23: public interface ValueRenderer {
24: /**
25: * Renders the specified value in the given template. The value ID will be
26: * of the form "<code>RENDER:<em>className</em></code>" or "<code>RENDER:<em>className</em>:<em>differentiator</em></code>",
27: * where "<code>className</code>" is the fully qualified name of this
28: * class.
29: *
30: * @param template the template into which the returned string will be
31: * inserted
32: * @param valueId the ID of the value in the given template whose value
33: * will be set to the returned string
34: * @param differentiator the differentiator string passed as part of the
35: * value ID, or <code>null</code> if none was provided
36: * @return the rendered text
37: * @since 1.0
38: */
39: public String render(Template template, String valueId,
40: String differentiator);
41: }
|