terp - the Codemesh Modular
Template Interpreter v1.3.309

com.codemesh.terp.api
Interface TemplateSource


public interface TemplateSource

An interface implemented by objects that can be used as a source of template lookups by name. For example: you have a template that references another template. You could do it by its relative location but then you have hardcoded a dependency between the two. You could specify the template by an identifier that is used to look up the template somewhere else. That's what the TemplateSource interface provides.


Method Summary
 java.lang.Object getTemplate(java.lang.String identifier, java.lang.Object elem, TerpContext ctx)
          Returns the template specified by the given identifier.
 java.lang.Object getTemplate(java.lang.String identifier, TerpContext ctx)
          Returns the template specified by the given identifier.
 

Method Detail

getTemplate

java.lang.Object getTemplate(java.lang.String identifier,
                             TerpContext ctx)
Returns the template specified by the given identifier.

Parameters:
identifier - the template's unique identifier.
ctx - the context in which the lookup occurs.
Returns:
a suitable template source or null.

getTemplate

java.lang.Object getTemplate(java.lang.String identifier,
                             java.lang.Object elem,
                             TerpContext ctx)
Returns the template specified by the given identifier. This variant allows the lookup of an element specific override for the general (element-independent) value. Passing null for the element should yield the same value as calling the element- independent version of this method.

Parameters:
identifier - the template's unique identifier.
elem - the element for which we're interested in a template.
ctx - the context in which the lookup occurs.
Returns:
a suitable template source or null.

terp - the Codemesh Modular
Template Interpreter v1.3.309

Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.