org.liquidsite.app.template
Class PluginBean

java.lang.Object
  extended byorg.liquidsite.app.template.TemplateBean
      extended byorg.liquidsite.app.template.PluginBean
All Implemented Interfaces:
freemarker.template.TemplateHashModel, freemarker.template.TemplateModel

public class PluginBean
extends TemplateBean
implements freemarker.template.TemplateHashModel

The plugin bean. This class provides a template bean with a list of all currently loaded plugin beans. Upon access to a plugin bean, a new instance will also be created. The instance of each plugin bean is kept for the lifetime of this bean.


Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Method Summary
static void add(java.lang.String name, java.lang.Class cls)
          Adds a plugin class mapping.
 freemarker.template.TemplateModel get(java.lang.String id)
          Returns a plugin bean as a template model.
 boolean isEmpty()
          Checks if the hash model is empty.
static void removeAll()
          Removes all registered plugin class mappings.
 
Methods inherited from class org.liquidsite.app.template.TemplateBean
getContext, getContextRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static void add(java.lang.String name,
                       java.lang.Class cls)
                throws TemplateException
Adds a plugin class mapping.

Parameters:
name - the template bean name
cls - the template bean class
Throws:
TemplateException - if the template bean mapping couldn't be added

removeAll

public static void removeAll()
Removes all registered plugin class mappings.


isEmpty

public boolean isEmpty()
Checks if the hash model is empty.

Specified by:
isEmpty in interface freemarker.template.TemplateHashModel
Returns:
true if no plugin beans are available, or false otherwise

get

public freemarker.template.TemplateModel get(java.lang.String id)
Returns a plugin bean as a template model.

Specified by:
get in interface freemarker.template.TemplateHashModel
Parameters:
id - the plugin bean name
Returns:
the template model object, or null if the plugin name isn't defined