com.sforce.ws.template
Class Template

java.lang.Object
  extended by com.sforce.ws.template.Template

public class Template
extends Object

This class is used to execute a template. The common usage for this class is shown below:

Template template = new Template();

//set up implicit variables template.setProperty("name", value);

String templateFileName = ... //name of the template file String outputFile = ... //name of the file to the generated

//exec the template template.exec(templateFileName, outputFile);

Since:
1.0 Nov 22, 2005
Version:
1.0
Author:
http://cheenath.com

Constructor Summary
Template()
           
 
Method Summary
 void exec(String in, String out)
          execute the specified template and generate the specified output file.
 void setProperty(String name, Object value)
          sets up implicit variable for the script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template()
Method Detail

setProperty

public void setProperty(String name,
                        Object value)
sets up implicit variable for the script. You can use this variable from the script. You can also invoke methods associated with the variable.

Parameters:
name - name of the variable
value - value of the variable.

exec

public void exec(String in,
                 String out)
          throws IOException,
                 TemplateException
execute the specified template and generate the specified output file.

Parameters:
in - name of the template file.
out - name of the output file. If null, the output will be redirected to System.out
Throws:
IOException - failed to read/write file
TemplateException - failed to exec template


Copyright © 2012. All Rights Reserved.