|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
UserDataAttribute.java | - | 25% | 25% | 25% |
|
1 | /* | |
2 | * Copyright 2001-2004 (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: UserDataAttribute.java,v 1.6 2004/06/25 08:03:41 maartenc Exp $ | |
8 | */ | |
9 | ||
10 | package org.dom4j.util; | |
11 | ||
12 | import org.dom4j.QName; | |
13 | import org.dom4j.tree.DefaultAttribute; | |
14 | ||
15 | /** <p><code>UserDataAttribute</code> support the adornment of a user | |
16 | * data object on an Element or Attribute instance such that the | |
17 | * methods {@link #getData} {@link #setData(Object)} | |
18 | * will get and set the values of a user data object. | |
19 | * This can be useful for developers wishing to create XML trees and | |
20 | * adorn the trees with user defined objects.</p> | |
21 | * | |
22 | * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> | |
23 | * @version $Revision: 1.6 $ | |
24 | */ | |
25 | public class UserDataAttribute extends DefaultAttribute { | |
26 | ||
27 | /** The user data object */ | |
28 | private Object data; | |
29 | ||
30 | ||
31 | 0 | public UserDataAttribute(QName qname) { |
32 | 0 | super(qname); |
33 | } | |
34 | ||
35 | 8 | public UserDataAttribute(QName qname, String text) { |
36 | 8 | super(qname, text); |
37 | } | |
38 | ||
39 | ||
40 | 0 | public Object getData() { |
41 | 0 | return data; |
42 | } | |
43 | ||
44 | 0 | public void setData(Object data) { |
45 | 0 | this.data = data; |
46 | } | |
47 | } | |
48 | ||
49 | ||
50 | ||
51 | ||
52 | /* | |
53 | * Redistribution and use of this software and associated documentation | |
54 | * ("Software"), with or without modification, are permitted provided | |
55 | * that the following conditions are met: | |
56 | * | |
57 | * 1. Redistributions of source code must retain copyright | |
58 | * statements and notices. Redistributions must also contain a | |
59 | * copy of this document. | |
60 | * | |
61 | * 2. Redistributions in binary form must reproduce the | |
62 | * above copyright notice, this list of conditions and the | |
63 | * following disclaimer in the documentation and/or other | |
64 | * materials provided with the distribution. | |
65 | * | |
66 | * 3. The name "DOM4J" must not be used to endorse or promote | |
67 | * products derived from this Software without prior written | |
68 | * permission of MetaStuff, Ltd. For written permission, | |
69 | * please contact dom4j-info@metastuff.com. | |
70 | * | |
71 | * 4. Products derived from this Software may not be called "DOM4J" | |
72 | * nor may "DOM4J" appear in their names without prior written | |
73 | * permission of MetaStuff, Ltd. DOM4J is a registered | |
74 | * trademark of MetaStuff, Ltd. | |
75 | * | |
76 | * 5. Due credit should be given to the DOM4J Project - | |
77 | * http://www.dom4j.org | |
78 | * | |
79 | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS | |
80 | * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT | |
81 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
82 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
83 | * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
84 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
85 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
86 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
87 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
88 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
89 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
90 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
91 | * | |
92 | * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. | |
93 | * | |
94 | * $Id: UserDataAttribute.java,v 1.6 2004/06/25 08:03:41 maartenc Exp $ | |
95 | */ |
|