org.jamon
Class AbstractTemplateReplacer

java.lang.Object
  extended by org.jamon.AbstractTemplateReplacer
All Implemented Interfaces:
TemplateReplacer
Direct Known Subclasses:
FixedTemplateReplacer

public abstract class AbstractTemplateReplacer
extends java.lang.Object
implements TemplateReplacer

A base class for classes wishing to define a TemplateReplacer. Implementors need only define findReplacement(Class, Object)


Constructor Summary
AbstractTemplateReplacer()
           
 
Method Summary
protected abstract  AbstractTemplateProxy.ReplacementConstructor findReplacement(java.lang.Class<? extends AbstractTemplateProxy> p_proxyClass, java.lang.Object p_jamonContext)
          Find an appropriate AbstractTemplateProxy.ReplacementConstructor for a template, if there is one.
 AbstractTemplateProxy getReplacement(AbstractTemplateProxy p_proxy, java.lang.Object p_jamonContext)
          Get the replacement for a proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTemplateReplacer

public AbstractTemplateReplacer()
Method Detail

getReplacement

public AbstractTemplateProxy getReplacement(AbstractTemplateProxy p_proxy,
                                            java.lang.Object p_jamonContext)
Description copied from interface: TemplateReplacer
Get the replacement for a proxy. If the proxied template is not being replaced via a <%replaces> tag in another template, simply return p_proxy. Otherwise, create the appropriate replacement proxy instance and call AbstractTemplateProxy.ImplDataCompatible.populateFrom(org.jamon.AbstractTemplateProxy.ImplData) on it's implData instance.

Specified by:
getReplacement in interface TemplateReplacer
Parameters:
p_proxy - the proxy to possibly replace.
Returns:
p_proxy or a proxy instance for a template replacing p_proxy's template.

findReplacement

protected abstract AbstractTemplateProxy.ReplacementConstructor findReplacement(java.lang.Class<? extends AbstractTemplateProxy> p_proxyClass,
                                                                                java.lang.Object p_jamonContext)
Find an appropriate AbstractTemplateProxy.ReplacementConstructor for a template, if there is one.

Parameters:
p_proxyClass - the class to find a replacement for.
p_jamonContext - the jamonContext
Returns:
the ReplacementConstructor for the template which will serve as a replacement, or null if there is to be no replacement performed.


jamon