org.jamon
Class FixedTemplateReplacer

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

public class FixedTemplateReplacer
extends AbstractTemplateReplacer

A TemplateReplacer which ignores any jamonContext and replaces templates based on a fixed list of template passed in at startup. While reflection is used when this class is constructed, after that it is reflection-free.


Constructor Summary
FixedTemplateReplacer(java.util.Collection<java.lang.Class<? extends AbstractTemplateProxy>> p_replacements)
          Create a new instance.
 
Method Summary
protected  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.
 
Methods inherited from class org.jamon.AbstractTemplateReplacer
getReplacement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedTemplateReplacer

public FixedTemplateReplacer(java.util.Collection<java.lang.Class<? extends AbstractTemplateProxy>> p_replacements)
Create a new instance.

Parameters:
p_replacements - A collection of replacing template classes.
Throws:
java.lang.IllegalArgumentException - if any of the passed in classes do not correspond to templates which replace another template, or if two replacing templates replace the same template.
Method Detail

findReplacement

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

Specified by:
findReplacement in class AbstractTemplateReplacer
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