org.apache.velocity.runtime.directive
Class Break
java.lang.Object
org.apache.velocity.runtime.directive.Directive
org.apache.velocity.runtime.directive.Break
- All Implemented Interfaces:
- Cloneable, DirectiveConstants
public class Break
- extends Directive
Break directive used for interrupting foreach loops.
- Version:
- $Id$
- Author:
- Jarkko Viinamaki
Fields inherited from class org.apache.velocity.runtime.directive.Directive |
rsvc |
Constructor Summary |
Break()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Break
public Break()
getName
public String getName()
- Return name of this directive.
- Specified by:
getName
in class Directive
- Returns:
- The name of this directive.
getType
public int getType()
- Return type of this directive.
- Specified by:
getType
in class Directive
- Returns:
- The type of this directive.
init
public void init(RuntimeServices rs,
InternalContextAdapter context,
Node node)
throws TemplateInitException
- simple init - init the tree and get the elementKey from
the AST
- Overrides:
init
in class Directive
- Parameters:
rs
- context
- node
-
- Throws:
TemplateInitException
render
public boolean render(InternalContextAdapter context,
Writer writer,
Node node)
throws IOException,
MethodInvocationException,
ResourceNotFoundException,
ParseErrorException
- Break directive does not actually do any rendering.
This directive throws a BreakException (RuntimeException) which
signals foreach directive to break out of the loop. Note that this
directive does not verify that it is being called inside a foreach
loop.
- Specified by:
render
in class Directive
- Parameters:
context
- writer
- node
-
- Returns:
- true if the directive rendered successfully.
- Throws:
IOException
MethodInvocationException
ResourceNotFoundException
ParseErrorException
Copyright © 2000-2008 The Apache Software Foundation. All Rights Reserved.