freemarker.template
Interface TransformControl
public interface TransformControl
An interface that can be implemented by writers returned from
TemplateTransformModel.getWriter(java.io.Writer, java.util.Map)
. The
methods on this
interfaces are callbacks that will be called by the template engine and that
give the writer a chance to better control the evaluation of the transform
body. The writer can instruct the engine to skip or to repeat body
evaluation, and gets notified about exceptions that are thrown during the
body evaluation.
$Id: TransformControl.java,v 1.11 2005/06/16 18:13:58 ddekany Exp $static int | END_EVALUATION - Constant returned from
afterBody() that tells the
template engine to end the transform and close the writer.
|
static int | EVALUATE_BODY - Constant returned from
onStart() that tells the
template engine to evaluate the body.
|
static int | REPEAT_EVALUATION - Constant returned from
afterBody() that tells the
template engine to repeat transform body evaluation and feed
it again to the transform.
|
static int | SKIP_BODY - Constant returned from
onStart() that tells the
template engine to skip evaluation of the body.
|
int | afterBody() - Called after the body has been evaluated.
|
void | onError(Throwable t) - Called if any exception occurs during the transform between the
TemplateTransformModel.getWriter(java.io.Writer, java.util.Map) call
and the java.io.Writer.close() call.
|
int | onStart() - Called before the body is evaluated for the first time.
|
END_EVALUATION
public static final int END_EVALUATION
Constant returned from
afterBody()
that tells the
template engine to end the transform and close the writer.
EVALUATE_BODY
public static final int EVALUATE_BODY
Constant returned from
onStart()
that tells the
template engine to evaluate the body.
REPEAT_EVALUATION
public static final int REPEAT_EVALUATION
Constant returned from
afterBody()
that tells the
template engine to repeat transform body evaluation and feed
it again to the transform.
SKIP_BODY
public static final int SKIP_BODY
Constant returned from
onStart()
that tells the
template engine to skip evaluation of the body.
afterBody
public int afterBody()
throws TemplateModelException,
IOException
Called after the body has been evaluated.
- END_EVALUATION if the transformation should be ended.
- REPEAT_EVALUATION to have the engine re-evaluate the
transform body and feed it again to the writer.
onError
public void onError(Throwable t)
throws Throwable
Called if any exception occurs during the transform between the
TemplateTransformModel.getWriter(java.io.Writer, java.util.Map)
call
and the java.io.Writer.close()
call.
t
- the throwable that represents the exception. It can be any
non-checked throwable, as well as TemplateException
and
java.io.IOException
.
onStart
public int onStart()
throws TemplateModelException,
IOException
Called before the body is evaluated for the first time.
- SKIP_BODY if the transform wants to ignore the body. In this
case, only
java.io.Writer.close()
is called next and processing ends. - EVALUATE_BODY to normally evaluate the body of the transform
and feed it to the writer