1 57 58 package org.apache.soap.encoding.soapenc; 59 60 import java.beans.*; 61 import java.io.*; 62 import java.util.*; 63 import java.lang.reflect.*; 64 import org.w3c.dom.*; 65 import org.apache.soap.util.*; 66 import org.apache.soap.util.xml.*; 67 import org.apache.soap.*; 68 import org.apache.soap.rpc.*; 69 70 79 public class MapSerializer implements Serializer, Deserializer 80 { 81 private final HashtableSerializer hashtableSer = new HashtableSerializer(); 82 83 public void marshall(String inScopeEncStyle, 84 Class javaType, 85 Object src, 86 Object context, 87 Writer sink, 88 NSStack nsStack, 89 XMLJavaMappingRegistry xjmr, 90 SOAPContext ctx) 91 throws IllegalArgumentException , IOException 92 { 93 Hashtable hashtable = null; 94 95 if (src instanceof Hashtable) 96 { 97 hashtable = (Hashtable)src; 98 } 99 else if (src instanceof Map) 100 { 101 hashtable = new Hashtable(); 102 hashtable.putAll((Map)src); 103 } 104 else 105 { 106 throw new IllegalArgumentException ("Tried to pass a '" + 107 src.getClass().toString() + 108 "' to MapSerializer"); 109 } 110 111 hashtableSer.marshall(inScopeEncStyle, 112 Hashtable.class, 113 hashtable, 114 context, 115 sink, 116 nsStack, 117 xjmr, 118 ctx); 119 } 120 121 public Bean unmarshall(String inScopeEncStyle, 122 QName elementType, 123 Node src, 124 XMLJavaMappingRegistry xjmr, 125 SOAPContext ctx) 126 throws IllegalArgumentException 127 { 128 return hashtableSer.unmarshall(inScopeEncStyle, 129 elementType, 130 src, 131 xjmr, 132 ctx); 133 } 134 } 135 | Popular Tags |