VectorSerializerpublic class VectorSerializer extends Object implements org.apache.axis.encoding.SerializerA VectorSerializer is be used to serialize and
deserialize Vectors using the SOAP-ENC
encoding style. |
Fields Summary |
---|
protected static Log | log |
Methods Summary |
---|
public java.lang.String | getMechanismType() return Constants.AXIS_SAX;
| public boolean | isRecursive(org.apache.axis.utils.IdentityHashMap map, java.util.Vector vector)
map.add(vector);
boolean recursive = false;
for(int i=0;i<vector.size() && !recursive;i++)
{
Object o = vector.get(i);
if(o instanceof Vector) {
if(map.containsKey(o)) {
return true;
} else {
recursive = isRecursive(map, (Vector)o);
}
}
}
return recursive;
| public void | serialize(javax.xml.namespace.QName name, org.xml.sax.Attributes attributes, java.lang.Object value, org.apache.axis.encoding.SerializationContext context)Serialize a Vector
Walk the collection of keys, serializing each key/value pair
inside an - element.
if (!(value instanceof Vector))
throw new IOException(
Messages.getMessage("noVector00", "VectorSerializer",
value.getClass().getName()));
Vector vector = (Vector)value;
// Check for circular references.
if(isRecursive(new IdentityHashMap(), vector)){
throw new IOException(Messages.getMessage("badVector00"));
}
context.startElement(name, attributes);
for (Iterator i = vector.iterator(); i.hasNext(); )
{
Object item = i.next();
context.serialize(Constants.QNAME_LITERAL_ITEM, null, item);
}
context.endElement();
| public org.w3c.dom.Element | writeSchema(java.lang.Class javaType, org.apache.axis.wsdl.fromJava.Types types)Return XML schema for the specified type, suitable for insertion into
the <types> element of a WSDL document, or underneath an
<element> or <attribute> declaration.
Element complexType = types.createElement("complexType");
complexType.setAttribute("name", "Vector");
types.writeSchemaTypeDecl(Constants.SOAP_VECTOR, complexType);
Element seq = types.createElement("sequence");
complexType.appendChild(seq);
Element element = types.createElement("element");
element.setAttribute("name", "item");
element.setAttribute("minOccurs", "0");
element.setAttribute("maxOccurs", "unbounded");
element.setAttribute("type", "xsd:anyType");
seq.appendChild(element);
return complexType;
|
|