1 /*
2 * $Id: ModelBody.java 1044817 2010-12-12 13:22:01Z apetrelli $
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 package org.apache.tiles.autotag.core.runtime;
22
23 import java.io.IOException;
24 import java.io.Writer;
25
26 /**
27 * Abstracts a tag/directive body.
28 *
29 * @version $Rev: 1044817 $ $Date: 2010-12-12 14:22:01 +0100 (Sun, 12 Dec 2010) $
30 */
31 public interface ModelBody {
32
33 /**
34 * Evaluates a body and returns it as a string.
35 *
36 * @return The body, as a string.
37 * @throws IOException If something goes wrong.
38 */
39 String evaluateAsString() throws IOException;
40
41 /**
42 * Evaluates a body, but discards result.
43 *
44 * @throws IOException If something goes wrong.
45 */
46 void evaluateWithoutWriting() throws IOException;
47
48 /**
49 * Evaluates the body and writes in the default writer.
50 *
51 * @throws IOException If something goes wrong.
52 */
53 void evaluate() throws IOException;
54
55 /**
56 * Evaluates the body and writes the result in the writer.
57 *
58 * @param writer The writer to write the result into.
59 * @throws IOException If something goes wrong.
60 */
61 void evaluate(Writer writer) throws IOException;
62 }