You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Glen Daniels <gd...@locus.apache.org> on 2000/07/06 20:19:03 UTC
cvs commit: xml-soap/java/src/org/apache/soap/encoding SOAPMappingRegistry.java
gdaniels 00/07/06 11:19:03
Modified: java/src/org/apache/soap/encoding SOAPMappingRegistry.java
Log:
Add support for serializing Vectors/Enumerations via VectorSerializer.
Revision Changes Path
1.3 +18 -14 xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java
Index: SOAPMappingRegistry.java
===================================================================
RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/SOAPMappingRegistry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SOAPMappingRegistry.java 2000/05/30 10:23:55 1.2
+++ SOAPMappingRegistry.java 2000/07/06 18:19:03 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "SOAP" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -94,6 +94,7 @@
private final ParameterSerializer paramSer = new ParameterSerializer();
private final ArraySerializer arraySer = new ArraySerializer();
+ private final VectorSerializer vectorSer = new VectorSerializer();
private final XMLParameterSerializer xmlParamSer =
new XMLParameterSerializer();
@@ -121,12 +122,12 @@
try {
Class XMISerializer = Class.forName("org.apache.soap.util.xml.XMISerializer");
- Class XMIParameterSerializer =
+ Class XMIParameterSerializer =
Class.forName("org.apache.soap.encoding.xmi.XMIParameterSerializer");
// Register default serializers for XMI encoding style.
mapTypes(Constants.NS_URI_XMI_ENC, null, null,
- (Serializer)XMISerializer.newInstance(),
+ (Serializer)XMISerializer.newInstance(),
(Deserializer)XMIParameterSerializer.newInstance());
// Register serializer for Parameter class - not deserializer!
@@ -216,7 +217,7 @@
Register mapping of element type to/from Java type along with
the serializer and deserializer for it. Note that we register
the same serializer for primitives and their object wrapper
- counterparts. What this means is that once encoded into
+ counterparts. What this means is that once encoded into
SOAP_ENC, a primitive int and an Integer, for example, are
indistinguishable. We believe (at least for now :-)) that this
is the right thing to do .. that is, upon seeing an element
@@ -238,6 +239,8 @@
mapTypes(soapEncURI, shortQName, short.class, ser, deser);
mapTypes(soapEncURI, byteQName, Byte.class, ser, null);
mapTypes(soapEncURI, byteQName, byte.class, ser, deser);
+
+ mapTypes(soapEncURI, null, Vector.class, vectorSer, null);
}
/**
@@ -257,7 +260,8 @@
catch (IllegalArgumentException e)
{
if (javaType != null
- && javaType.isArray()
+ && (javaType.isArray() || (javaType.equals(Vector.class) ||
+ (Enumeration.class.isAssignableFrom(javaType))))
&& encodingStyleURI != null
&& encodingStyleURI.equals(soapEncURI))
{
@@ -287,16 +291,16 @@
catch (IllegalArgumentException e)
{
if (javaType != null
- && javaType.isArray()
&& encodingStyleURI != null
&& encodingStyleURI.equals(soapEncURI))
{
- return arraySer;
+ if (javaType.isArray()) {
+ return arraySer;
+ } else if (Enumeration.class.isAssignableFrom(javaType)) {
+ return vectorSer;
+ }
}
- else
- {
- throw e;
- }
+ throw e;
}
}
}