1 /*
2 Copyright (c) 2007 Health Market Science, Inc.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16
17 package com.healthmarketscience.common.util;
18
19 import java.io.IOException;
20
21 /**
22 * Should be implemented by an object which can append itself to an
23 * AppendableExt object, where the work of generating a result for
24 * {@code toString()} would itself involve the appending of multiple
25 * CharSequences (Strings, etc).
26 * <p>
27 * In general, it is expected that the data appended to the AppendableExt an
28 * {@link #appendTo} invocation be the same as the result of a call to
29 * {@link Object#toString}. If this is not the case, it should be clearly
30 * documented in the class.
31 *
32 * @author James Ahlborn
33 */
34 public interface Appendee {
35
36 /**
37 * Appends this object to the given AppendableExt. Called by an
38 * AppendableExt when a request is made to append an instance of Appendee.
39 *
40 * @param a the AppendableExt to which this class should append itself
41 * @throws IOException if the append fails
42 */
43 public void appendTo(AppendableExt a) throws IOException;
44
45 }