KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > io > read > ElementMapping


1 /*
2  * Copyright 2001-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 package org.apache.commons.betwixt.io.read;
17
18 import org.apache.commons.betwixt.ElementDescriptor;
19 import org.xml.sax.Attributes JavaDoc;
20
21 /**
22   * Describes a mapping between an xml element and a betwixt element.
23   *
24   * @author Robert Burrell Donkin
25   * @since 0.5
26   */

27 public class ElementMapping {
28     
29     /** Namespace of the xml element */
30     private String JavaDoc namespace;
31     /** Name of the element */
32     private String JavaDoc name;
33     /** Attributes associated with this element */
34     private Attributes JavaDoc attributes;
35     /** The base type of the mapped bean */
36     private Class JavaDoc type;
37     /** The mapped descriptor */
38     private ElementDescriptor descriptor;
39    
40     /** Base constructor */
41     public ElementMapping() {}
42     
43     /**
44       * Gets the namespace URI or an empty string if the parser is not namespace aware
45       * or the element has no namespace.
46       * @return namespace possibly null
47       */

48     public String JavaDoc getNamespace() {
49         return namespace;
50     }
51     
52     /**
53       * Sets the namespace URI for this element
54       * @param namespace the namespace uri, possibly null
55       */

56     public void setNamespace(String JavaDoc namespace) {
57         this.namespace = namespace;
58     }
59     
60     /**
61       * Gets the local name if the parser is namespace aware, otherwise the name.
62       * @return the element name, possibly null
63       */

64     public String JavaDoc getName() {
65         return name;
66     }
67     
68     /**
69       * Sets the local name for this element.
70       * @param name the element name, possibly null
71       */

72     public void setName(String JavaDoc name) {
73         this.name = name;
74     }
75     
76     /**
77       * Gets the element's attributes.
78       * @return the Attributes for this element, possibly null.
79       */

80     public Attributes JavaDoc getAttributes() {
81         return attributes;
82     }
83     
84     /**
85       * Sets the element's attributes
86       * @param attributes the element's attributes, possibly null
87       */

88     public void setAttributes(Attributes JavaDoc attributes) {
89         this.attributes = attributes;
90     }
91     
92     /**
93       * Gets the base type for this element.
94       * The base type may - or may not - correspond to the created type.
95       * @return the Class of the base type for this element
96       */

97     public Class JavaDoc getType() {
98         return type;
99     }
100     
101     /**
102       * Sets the base type for this element.
103       * The base type may - or may not - correspond to the created type.
104       * @param type the Class of the base type for this element
105       */

106     public void setType(Class JavaDoc type) {
107         this.type = type;
108     }
109     
110     /**
111       * Gets the mapped element descriptor.
112       * @return the mapped ElementDescriptor
113       */

114     public ElementDescriptor getDescriptor() {
115         return descriptor;
116     }
117     
118     /**
119       * Sets the mapped element descriptor.
120       * @param descriptor set this descriptor
121       */

122     public void setDescriptor(ElementDescriptor descriptor) {
123         this.descriptor = descriptor;
124     }
125 }
126
Popular Tags