blob: 9026b0f3bafc58f89e28bed29e6f40c8f06a2304 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cocoon.taglib;
import org.xml.sax.SAXException;
/**
* The IterationTag interface extends Tag by defining one additional
* method that controls the reevaluation of its body.
*
* <p> A tag handler that implements IterationTag is treated as one that
* implements Tag regarding the doStartTag() and doEndTag() methods.
* IterationTag provides a new method: <code>doAfterBody()</code>.
*
* <p> The doAfterBody() method is invoked after every body evaluation
* to control whether the body will be reevaluated or not. If doAfterBody()
* returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated.
* If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped
* and doEndTag() will be evaluated instead.
*
* @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
* @version CVS $Id$
*/
public interface IterationTag extends Tag {
/**
* Request the reevaluation of some body.
* Returned from doAfterBody.
*/
public final static int EVAL_BODY_AGAIN = 2;
/**
* Process body (re)evaluation. This method is invoked by the
* Taglib implementation object after every evaluation of
* the body into the BodyEvaluation object. The method is
* not invoked if there is no body evaluation.
*
* <p>
* If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the
* body will happen (followed by another invocation of doAfterBody).
* If doAfterBody returns SKIP_BODY no more body evaluations will
* occur and then doEndTag will be invoked.
*
* <p>
* The method re-invocations may be lead to different actions because
* there might have been some changes to shared state, or because
* of external computation.
*
* @return whether additional evaluations of the body are desired
* @throws SAXException
*/
int doAfterBody() throws SAXException;
}