KickJava   Java API By Example, From Geeks To Geeks.

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


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: DefaultAttribute.java,v 1.1 2003/11/02 18:10:03 per_nyfelt Exp $
8  */

9
10 package org.ozoneDB.xml.dom4j.o3impl;
11
12 import org.dom4j.Element;
13 import org.dom4j.Namespace;
14 import org.dom4j.NodeFactory;
15 import org.dom4j.QName;
16
17 /** <p><code>DefaultAttribute</code> implements a doubly linked node which
18  * supports the parent relationship and is mutable.</p>
19  *
20  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan</a>
21  * @version $Revision: 1.1 $
22  */

23 public class DefaultAttribute extends FlyweightAttribute {
24
25     /** The parent of this node */
26     private Element parent;
27
28
29     public DefaultAttribute(QName qname) {
30         super(qname);
31     }
32
33     public DefaultAttribute(QName qname, String JavaDoc value) {
34         super(qname, value);
35     }
36
37     public DefaultAttribute(Element parent, QName qname, String JavaDoc value) {
38         super(qname, value);
39         this.parent = parent;
40     }
41
42     /** Creates the <code>Attribute</code> with the specified local name
43      * and value.
44      *
45      * @param name is the name of the attribute
46      * @param value is the value of the attribute
47      */

48     public DefaultAttribute(NodeFactory nodeFactory, String JavaDoc name, String JavaDoc value) {
49         super(nodeFactory, name, value);
50     }
51
52     /** Creates the <code>Attribute</code> with the specified local name,
53      * value and <code>AbstractNamespace</code>.
54      *
55      * @param nodeFactory is the Nodefactury used to create a QName from the name
56      * @param name is the name of the attribute
57      * @param value is the value of the attribute
58      * @param namespace is the namespace of the attribute
59      */

60     public DefaultAttribute(NodeFactory nodeFactory, String JavaDoc name, String JavaDoc value, Namespace namespace) {
61         super(nodeFactory, name, value, namespace);
62     }
63
64     /** Creates the <code>Attribute</code> with the specified local name,
65      * value and <code>AbstractNamespace</code>.
66      *
67      * @param nodeFactory is the Nodefactury used to create a QName from the name
68      * @param parent is the parent element
69      * @param name is the name of the attribute
70      * @param value is the value of the attribute
71      * @param namespace is the namespace of the attribute
72      */

73     public DefaultAttribute(NodeFactory nodeFactory, Element parent, String JavaDoc name, String JavaDoc value, Namespace namespace) {
74         super(nodeFactory, name, value, namespace);
75         this.parent = parent;
76     }
77
78     public void setValue(String JavaDoc value) {
79         this.value = value;
80     }
81
82     public Element getParent() {
83         return parent;
84     }
85
86     public void setParent(Element parent) {
87         this.parent = parent;
88     }
89
90     public boolean supportsParent() {
91         return true;
92     }
93
94     public boolean isReadOnly() {
95         return false;
96     }
97
98 }
99
100
101 /*
102  * Redistribution and use of this software and associated documentation
103  * ("Software"), with or without modification, are permitted provided
104  * that the following conditions are met:
105  *
106  * 1. Redistributions of source code must retain copyright
107  * statements and notices. Redistributions must also contain a
108  * copy of this document.
109  *
110  * 2. Redistributions in binary form must reproduce the
111  * above copyright notice, this list of conditions and the
112  * following disclaimer in the documentation and/or other
113  * materials provided with the distribution.
114  *
115  * 3. The name "DOM4J" must not be used to endorse or promote
116  * products derived from this Software without prior written
117  * permission of MetaStuff, Ltd. For written permission,
118  * please contact dom4j-info@metastuff.com.
119  *
120  * 4. Products derived from this Software may not be called "DOM4J"
121  * nor may "DOM4J" appear in their names without prior written
122  * permission of MetaStuff, Ltd. DOM4J is a registered
123  * trademark of MetaStuff, Ltd.
124  *
125  * 5. Due credit should be given to the DOM4J Project
126  * (http://dom4j.org/).
127  *
128  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
129  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
130  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
131  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
132  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
133  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
134  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
135  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
136  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
137  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
138  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
139  * OF THE POSSIBILITY OF SUCH DAMAGE.
140  *
141  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
142  *
143  * $Id: DefaultAttribute.java,v 1.1 2003/11/02 18:10:03 per_nyfelt Exp $
144  */

145
Popular Tags