to.etc.template
Class TplExpander

java.lang.Object
  extended by to.etc.template.TplExpander
Direct Known Subclasses:
ServletTplExpander

Deprecated.

@Deprecated
public class TplExpander
extends java.lang.Object

VERY OLD - DO NOT USE Expands simple templates in runtime. All instances of $name are replaced with the value of name in the context hash table. When the tag is encountered, the value is looked up in the context; it must be an iteration, array or enumeration. If so, the data following the loop tag till the tag is repeated for each instance of the enumeration.

Expanded names (default) are:

This uses Java Introspection to allow very basic functions to be called on variables found thru the context. For a name like foo.bar it will attempt to get an object by looking up the key foo in the hash table. It will then look for a function that is called getBar() or bar() on that object. When found it will call that function and the result will be used for the next item in the dotted list.

Author:
Frits Jalvingh

Field Summary
protected  TplCallback m_cb
          Deprecated.  
protected  java.lang.String m_hostname
          Deprecated.  
protected  int m_hostport
          Deprecated.  
protected  java.lang.String m_hosturl
          Deprecated.  
protected  java.lang.String m_servlet_basepath
          Deprecated.  
protected  java.lang.String m_servlet_fullpath
          Deprecated.  
 
Constructor Summary
TplExpander(TplCallback cb)
          Deprecated. Constructor
 
Method Summary
 void expand(java.io.InputStream is, java.io.PrintWriter pw)
          Deprecated. Expands the template to the printwriter spec'd.
 java.lang.String expand(java.lang.String input)
          Deprecated.  
 void expand(java.lang.String input, java.io.PrintWriter output)
          Deprecated.  
 java.lang.Object findName(java.lang.String name)
          Deprecated. This function can be overridden to provide more predefined names.
protected  java.lang.Object findPredef(java.lang.String name)
          Deprecated. If the name passed is a predefined name this function will return the result object for the name.
protected  java.lang.Object locateName(java.lang.String name)
          Deprecated. Locates a root name.
 void putDummy(java.lang.String name)
          Deprecated. This method posts the "dummy getter" method for a given name.
 void putGetter(java.lang.String name, java.lang.Object o)
          Deprecated.  
protected  java.lang.String slconc(java.lang.String s1, java.lang.String s2)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cb

protected TplCallback m_cb
Deprecated. 

m_servlet_basepath

protected java.lang.String m_servlet_basepath
Deprecated. 

m_servlet_fullpath

protected java.lang.String m_servlet_fullpath
Deprecated. 

m_hosturl

protected java.lang.String m_hosturl
Deprecated. 

m_hostname

protected java.lang.String m_hostname
Deprecated. 

m_hostport

protected int m_hostport
Deprecated. 
Constructor Detail

TplExpander

public TplExpander(TplCallback cb)
Deprecated. 
Constructor

Method Detail

slconc

protected java.lang.String slconc(java.lang.String s1,
                                  java.lang.String s2)
Deprecated. 

expand

public void expand(java.io.InputStream is,
                   java.io.PrintWriter pw)
            throws java.lang.Exception
Deprecated. 
Expands the template to the printwriter spec'd.

Throws:
java.lang.Exception

expand

public void expand(java.lang.String input,
                   java.io.PrintWriter output)
            throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception

expand

public java.lang.String expand(java.lang.String input)
                        throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception

findName

public java.lang.Object findName(java.lang.String name)
Deprecated. 
This function can be overridden to provide more predefined names. It should return null if it does not recognise the name.


findPredef

protected java.lang.Object findPredef(java.lang.String name)
Deprecated. 
If the name passed is a predefined name this function will return the result object for the name. This is better than putting all predefined names in the hash table because many names must be computed, and building such a hash table takes time and resources (that are garbage after each request!). If the name passed is not a predefined name the routine returns null.


locateName

protected java.lang.Object locateName(java.lang.String name)
                               throws TplException
Deprecated. 
Locates a root name. The name is first searched in this-context's hashtable; then all user functions are tried. This allows the put method to override all names!!

Throws:
TplException

putGetter

public void putGetter(java.lang.String name,
                      java.lang.Object o)
Deprecated. 

putDummy

public void putDummy(java.lang.String name)
Deprecated. 
This method posts the "dummy getter" method for a given name. The dummy getter posts a class that returns, for all names retrieved from it, the empty string.