eu.scape_project.xa.tw.tmpl
Class Code

java.lang.Object
  extended by eu.scape_project.xa.tw.tmpl.Code
Direct Known Subclasses:
GenericCode, OperationCode, OutputItemCode, ResultElementCode, SectionCode, ServiceCode, ServiceXml, ServiceXmlOp

public abstract class Code
extends Object

Abstract class for code templates that can be evaluated by the Velocity template engine. Evaluation is performed by applying the Velocity context to the source code content.

Version:
0.3
Author:
shsdev https://github.com/shsdev

Constructor Summary
Code(String templateFilePath)
          Constructs a Code object from a template file
 
Method Summary
 void evaluate()
          Apply the Velocity evaluation
 String getCode()
          Get the code (after the Velocity evaluation is completed)
 org.apache.velocity.VelocityContext getCtx()
           
 void put(String key, String val)
          Add a key value pair to the Velocity context
 void put(org.apache.velocity.VelocityContext context)
           
 void setCode(String code)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Code

public Code(String templateFilePath)
     throws IOException
Constructs a Code object from a template file

Parameters:
templateFilePath - the strin path to the template file
Throws:
IOException
Method Detail

getCode

public String getCode()
Get the code (after the Velocity evaluation is completed)

Returns:
The code after the Velocity evaluation is completed

put

public void put(String key,
                String val)
Add a key value pair to the Velocity context

Parameters:
key - Key
val - Value

put

public void put(org.apache.velocity.VelocityContext context)
Parameters:
context -

evaluate

public void evaluate()
Apply the Velocity evaluation

Parameters:
context -

getCtx

public org.apache.velocity.VelocityContext getCtx()
Returns:
the ctx

setCode

public void setCode(String code)
Parameters:
code - the code to set


Copyright © 2013. All Rights Reserved.