org.apache.velocity.runtime.directive
Class Directive

java.lang.Object
  extended by org.apache.velocity.runtime.directive.Directive
All Implemented Interfaces:
Cloneable, DirectiveConstants
Direct Known Subclasses:
Foreach, InputBase, Literal, Macro, VelocimacroProxy

public abstract class Directive
extends Object
implements DirectiveConstants, Cloneable

Base class for all directives used in Velocity.

Version:
$Id: Directive.java 471381 2006-11-05 08:56:58Z wglass $
Author:
Jason van Zyl

Field Summary
protected  RuntimeServices rsvc
           
 
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants
BLOCK, LINE
 
Constructor Summary
Directive()
           
 
Method Summary
 int getColumn()
          for log msg purposes
 int getLine()
          for log msg purposes
abstract  String getName()
          Return the name of this directive.
abstract  int getType()
          Get the directive type BLOCK/LINE.
 void init(RuntimeServices rs, InternalContextAdapter context, Node node)
          How this directive is to be initialized.
abstract  boolean render(InternalContextAdapter context, Writer writer, Node node)
          How this directive is to be rendered
 void setLocation(int line, int column)
          Allows the template location to be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rsvc

protected RuntimeServices rsvc
Constructor Detail

Directive

public Directive()
Method Detail

getName

public abstract String getName()
Return the name of this directive.

Returns:
The name of this directive.

getType

public abstract int getType()
Get the directive type BLOCK/LINE.

Returns:
The directive type BLOCK/LINE.

setLocation

public void setLocation(int line,
                        int column)
Allows the template location to be set.

Parameters:
line -
column -

getLine

public int getLine()
for log msg purposes

Returns:
The current line for log msg purposes.

getColumn

public int getColumn()
for log msg purposes

Returns:
The current column for log msg purposes.

init

public void init(RuntimeServices rs,
                 InternalContextAdapter context,
                 Node node)
          throws TemplateInitException
How this directive is to be initialized.

Parameters:
rs -
context -
node -
Throws:
TemplateInitException

render

public abstract boolean render(InternalContextAdapter context,
                               Writer writer,
                               Node node)
                        throws IOException,
                               ResourceNotFoundException,
                               ParseErrorException,
                               MethodInvocationException
How this directive is to be rendered

Parameters:
context -
writer -
node -
Returns:
True if the directive rendered successfully.
Throws:
IOException
ResourceNotFoundException
ParseErrorException
MethodInvocationException


Copyright © 2000-2007 The Apache Software Foundation. All Rights Reserved.