KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > rendering > StringBuilderRenderAppender


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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  * $Header:$
17  */

18 package org.apache.beehive.netui.tags.rendering;
19
20 import org.apache.beehive.netui.util.internal.InternalStringBuilder;
21
22 /**
23  * This is an implementation of {@link AbstractRenderAppender} which appends
24  * Strings to a {@link InternalStringBuilder}
25  */

26 public class StringBuilderRenderAppender
27     extends AbstractRenderAppender
28 {
29     private InternalStringBuilder _sb;
30
31     public StringBuilderRenderAppender()
32     {
33     }
34
35     public StringBuilderRenderAppender(InternalStringBuilder sb)
36     {
37         _sb = sb;
38     }
39
40     public void setInternalStringBuilder(InternalStringBuilder sb)
41     {
42         _sb = sb;
43     }
44
45     public void append(String JavaDoc s)
46     {
47         assert _sb != null : "Render appender doesn't have a valid string builder";
48         _sb.append(s);
49     }
50
51     public void append(char c)
52     {
53         assert _sb != null : "Render appender doesn't have a valid string builder";
54         _sb.append(c);
55     }
56
57     public String JavaDoc toString()
58     {
59         assert _sb != null : "Render appender doesn't have a valid string builder";
60         return _sb.toString();
61     }
62 }
63
Popular Tags