Class Define
java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.Block
org.apache.velocity.runtime.directive.Define
- All Implemented Interfaces:
Cloneable
,DirectiveConstants
Directive that puts an unrendered AST block in the context
under the specified key, postponing rendering until the
reference is used and rendered.
- Version:
- $Id: Define.java 686842 2008-08-18 18:29:31Z nbubna $
- Author:
- Andrew Tetlaw, Nathan Bubna
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.velocity.runtime.directive.Block
Block.Reference
-
Field Summary
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants
BLOCK, LINE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called by the parser to validate the argument typesgetName()
Return name of this directive.void
init
(RuntimeServices rs, InternalContextAdapter context, Node node) simple init - get the keyboolean
render
(InternalContextAdapter context, Writer writer, Node node) directive.render() simply makes an instance of the Block inner class and places it into the context as indicated.Methods inherited from class org.apache.velocity.runtime.directive.Directive
getColumn, getLine, getScopeName, getTemplate, getTemplateName, isScopeProvided, makeScope, postRender, preRender, setLocation, setLocation
-
Constructor Details
-
Define
public Define()
-
-
Method Details
-
getName
Return name of this directive. -
init
public void init(RuntimeServices rs, InternalContextAdapter context, Node node) throws TemplateInitException simple init - get the key- Overrides:
init
in classBlock
- Parameters:
rs
-context
-node
-- Throws:
TemplateInitException
-
render
directive.render() simply makes an instance of the Block inner class and places it into the context as indicated. -
checkArgs
public void checkArgs(ArrayList<Integer> argtypes, Token t, String templateName) throws ParseException Called by the parser to validate the argument types- Overrides:
checkArgs
in classDirective
- Parameters:
argtypes
- type, Array of argument types of each argument to the directive for example StandardParserTreeConstants.JJTWORDt
- token of directivetemplateName
- the name of the template this directive is referenced in.- Throws:
ParseException
-