1 /*
2 * Copyright (c) 2008 Rodrigo Ruiz
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.axis.message.addressing;
17
18 import javax.xml.namespace.QName;
19 import javax.xml.soap.SOAPElement;
20
21 import org.apache.axis.description.TypeDesc;
22 import org.apache.axis.encoding.Deserializer;
23 import org.apache.axis.encoding.Serializer;
24 import org.apache.axis.encoding.ser.BeanDeserializer;
25 import org.apache.axis.encoding.ser.BeanSerializer;
26 import org.w3c.dom.Element;
27
28 /**
29 * Java content class for ReferencePropertiesType complex type.
30 * <p>
31 * The following schema fragment specifies the expected content contained within
32 * this java content object. (defined at
33 * http://schemas.xmlsoap.org/ws/2004/08/addressing line 62)
34 * <p>
35 *
36 * <pre>
37 * <complexType name="ReferencePropertiesType">
38 * <complexContent>
39 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
40 * <sequence>
41 * <any/>
42 * </sequence>
43 * </restriction>
44 * </complexContent>
45 * </complexType>
46 * </pre>
47 *
48 * @author Davanum Srinivas
49 * @author Rodrigo Ruiz
50 * @version $Revision: 14 $
51 */
52 public class MetaDataType extends AnyContentTypeList {
53
54 /**
55 * <code>serialVersionUID</code> attribute.
56 */
57 private static final long serialVersionUID = 6805124334123876433L;
58
59 /**
60 * Type meta-data.
61 */
62 private static final TypeDesc TYPE_DESC = new TypeDesc(ReferencePropertiesType.class,
63 true);
64
65 static {
66 String ns = Constants.NS_URI_ADDRESSING_DEFAULT;
67 TYPE_DESC.setXmlType(new QName(ns, "MetaDataType"));
68 }
69
70 /**
71 * Parses an XML element node and extracts an instance of this class.
72 *
73 * @param element Element to parse
74 * @return Resulting instance
75 */
76 public static MetaDataType fromElement(Element element) {
77 MetaDataType metaData = new MetaDataType();
78 fromElement(metaData, element);
79 return metaData;
80 }
81
82 /**
83 * Parses a SOAP element and extracts an instance of this class.
84 *
85 * @param element Element to parse
86 * @return Resulting instance
87 */
88 public static MetaDataType fromSOAPElement(SOAPElement element) {
89 MetaDataType metaData = new MetaDataType();
90 fromSOAPElement(metaData, element);
91 return metaData;
92 }
93
94 /**
95 * Gets a custom Deserializer.
96 *
97 * @param mType not used
98 * @param jType Java type
99 * @param xType XML type
100 * @return A Deserializer instance
101 */
102 public static Deserializer getDeserializer(String mType, Class<?> jType, QName xType) {
103 return new BeanDeserializer(jType, xType, TYPE_DESC);
104 }
105
106 /**
107 * Gets a custom Serializer.
108 *
109 * @param mType not used
110 * @param jType Java type
111 * @param xType XML type
112 * @return A Serializer instance
113 */
114 public static Serializer getSerializer(String mType, Class<?> jType, QName xType) {
115 return new BeanSerializer(jType, xType, TYPE_DESC);
116 }
117
118 /**
119 * Return the type description object.
120 *
121 * @return Type type description for this class
122 */
123 public static TypeDesc getTypeDesc() {
124 return TYPE_DESC;
125 }
126
127 /**
128 * Creates a new instance.
129 */
130 public MetaDataType() {
131 }
132
133 /**
134 * Creates a new instance (performs shallow copy).
135 *
136 * @param metaData Meta-data to copy
137 */
138 public MetaDataType(MetaDataType metaData) {
139 super(metaData, false);
140 }
141
142 /**
143 * Creates a new instance, performing a shallow or deep copy of another
144 * instance.
145 *
146 * @param metaData Meta-data to copy
147 * @param deepCopy Whether to perform a shallow or deep copy
148 */
149 public MetaDataType(MetaDataType metaData, boolean deepCopy) {
150 super(metaData, deepCopy);
151 }
152
153 /**
154 * Creates a new instance and adds the specified object as an XML element.
155 *
156 * @param element Item to add
157 */
158 public MetaDataType(Object element) {
159 super(element);
160 }
161
162 /**
163 * {@inheritDoc}
164 */
165 public void append(Element parent) {
166 append(parent, Constants.METADATA);
167 }
168
169 /**
170 * {@inheritDoc}
171 */
172 @Override
173 public String toString() {
174 return super.toString("Metadata");
175 }
176
177 }