KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom4j > o3impl > FlyweightComment


1 /*
2  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  *
7  * $Id: FlyweightComment.java,v 1.2 2003/06/10 16:18:36 per_nyfelt Exp $
8  */

9
10 package org.ozoneDB.xml.dom4j.o3impl;
11
12 import org.dom4j.Comment;
13 import org.dom4j.Element;
14 import org.dom4j.Node;
15
16 /** <p><code>FlyweightComment</code> is a Flyweight pattern implementation
17  * of a singly linked, read-only XML Comment.</p>
18  *
19  * <p>This node could be shared across documents and elements though
20  * it does not support the parent relationship.</p>
21  *
22  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan</a>
23  * @version $Revision: 1.2 $
24  */

25 public class FlyweightComment extends AbstractComment implements Comment {
26
27     /** Text of the <code>Comment</code> node */
28     protected String JavaDoc text;
29
30     /** @param text is the Comment text
31      */

32     public FlyweightComment(String JavaDoc text) {
33         this.text = text;
34     }
35
36     public String JavaDoc getText() {
37         return text;
38     }
39
40     protected Node createXPathResult(Element parent) {
41         return new DefaultComment(parent, getText());
42     }
43 }
44
45
46 /*
47  * Redistribution and use of this software and associated documentation
48  * ("Software"), with or without modification, are permitted provided
49  * that the following conditions are met:
50  *
51  * 1. Redistributions of source code must retain copyright
52  * statements and notices. Redistributions must also contain a
53  * copy of this document.
54  *
55  * 2. Redistributions in binary form must reproduce the
56  * above copyright notice, this list of conditions and the
57  * following disclaimer in the documentation and/or other
58  * materials provided with the distribution.
59  *
60  * 3. The name "DOM4J" must not be used to endorse or promote
61  * products derived from this Software without prior written
62  * permission of MetaStuff, Ltd. For written permission,
63  * please contact dom4j-info@metastuff.com.
64  *
65  * 4. Products derived from this Software may not be called "DOM4J"
66  * nor may "DOM4J" appear in their names without prior written
67  * permission of MetaStuff, Ltd. DOM4J is a registered
68  * trademark of MetaStuff, Ltd.
69  *
70  * 5. Due credit should be given to the DOM4J Project
71  * (http://dom4j.org/).
72  *
73  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
74  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
75  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
76  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
77  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
78  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
79  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
80  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
81  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
82  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
83  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
84  * OF THE POSSIBILITY OF SUCH DAMAGE.
85  *
86  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
87  *
88  * $Id: FlyweightComment.java,v 1.2 2003/06/10 16:18:36 per_nyfelt Exp $
89  */

90
Popular Tags