public interface TransformControl
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.Modifier and Type | Field and Description |
---|---|
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. |
Modifier and Type | Method and Description |
---|---|
int |
afterBody()
Called after the body has been evaluated.
|
void |
onError(java.lang.Throwable t)
Called if any exception occurs during the transform between the
TemplateTransformModel.getWriter(java.io.Writer, java.util.Map) call
and the Writer.close() call. |
int |
onStart()
Called before the body is evaluated for the first time.
|
static final int REPEAT_EVALUATION
afterBody()
that tells the
template engine to repeat transform body evaluation and feed
it again to the transform.static final int END_EVALUATION
afterBody()
that tells the
template engine to end the transform and close the writer.static final int SKIP_BODY
onStart()
that tells the
template engine to skip evaluation of the body.static final int EVALUATE_BODY
onStart()
that tells the
template engine to evaluate the body.int onStart() throws TemplateModelException, java.io.IOException
Writer.close()
is called next and processing ends.TemplateModelException
java.io.IOException
int afterBody() throws TemplateModelException, java.io.IOException
TemplateModelException
java.io.IOException
void onError(java.lang.Throwable t) throws java.lang.Throwable
TemplateTransformModel.getWriter(java.io.Writer, java.util.Map)
call
and the Writer.close()
call.t
- the throwable that represents the exception. It can be any
non-checked throwable, as well as TemplateException
and
IOException
.java.lang.Throwable
- is recommended that the methods rethrow the received
throwable. If the method wants to throw another throwable, it should
either throw a non-checked throwable, or an instance of
TemplateException
and IOException
. Throwing any
other checked exception will cause the engine to rethrow it as
a UndeclaredThrowableException
.