1 16 17 package org.apache.axis.encoding; 18 19 import org.apache.axis.utils.Messages; 20 import org.apache.axis.Constants; 21 22 import javax.xml.namespace.QName ; 23 import javax.xml.rpc.JAXRPCException ; 24 25 32 public class TypeMappingDelegate implements TypeMapping { 33 static final TypeMappingImpl placeholder = new TypeMappingImpl(); 34 35 TypeMappingImpl delegate; 36 TypeMappingDelegate next; 37 38 41 TypeMappingDelegate(TypeMappingImpl delegate) { 42 if (delegate == null) { 43 throw new RuntimeException (Messages.getMessage("NullDelegate")); 44 } 45 this.delegate = delegate; 46 } 47 48 49 50 51 53 public String [] getSupportedEncodings() { 54 return delegate.getSupportedEncodings(); 55 } 56 57 public void setSupportedEncodings(String [] namespaceURIs) { 58 delegate.setSupportedEncodings(namespaceURIs); 59 } 60 61 69 public void register(Class javaType, QName xmlType, 70 javax.xml.rpc.encoding.SerializerFactory sf, 71 javax.xml.rpc.encoding.DeserializerFactory dsf) 72 throws JAXRPCException { 73 delegate.register(javaType, xmlType, sf, dsf); 74 } 75 76 public javax.xml.rpc.encoding.SerializerFactory 77 getSerializer(Class javaType, QName xmlType) 78 throws JAXRPCException 79 { 80 javax.xml.rpc.encoding.SerializerFactory sf = delegate.getSerializer(javaType, xmlType); 81 82 if (sf == null && next != null) { 83 sf = next.getSerializer(javaType, xmlType); 84 } 85 86 if (sf == null) { 87 sf = delegate.finalGetSerializer(javaType); 88 } 89 90 return sf; 91 } 92 public javax.xml.rpc.encoding.SerializerFactory 93 getSerializer(Class javaType) 94 throws JAXRPCException 95 { 96 return getSerializer(javaType, null); 97 } 98 99 public javax.xml.rpc.encoding.DeserializerFactory 100 getDeserializer(Class javaType, QName xmlType) 101 throws JAXRPCException { 102 return getDeserializer(javaType, xmlType, this); 103 } 104 105 public javax.xml.rpc.encoding.DeserializerFactory 106 getDeserializer(Class javaType, QName xmlType, TypeMappingDelegate start) 107 throws JAXRPCException { 108 javax.xml.rpc.encoding.DeserializerFactory df = 109 delegate.getDeserializer(javaType, xmlType, start); 110 if (df == null && next != null) { 111 df = next.getDeserializer(javaType, xmlType, start); 112 } 113 if (df == null) { 114 df = delegate.finalGetDeserializer(javaType, xmlType, start); 115 } 116 return df; 117 } 118 119 public javax.xml.rpc.encoding.DeserializerFactory 120 getDeserializer(QName xmlType) 121 throws JAXRPCException { 122 return getDeserializer(null, xmlType); 123 } 124 125 public void removeSerializer(Class javaType, QName xmlType) 126 throws JAXRPCException { 127 delegate.removeSerializer(javaType, xmlType); 128 } 129 130 public void removeDeserializer(Class javaType, QName xmlType) 131 throws JAXRPCException { 132 delegate.removeDeserializer(javaType, xmlType); 133 } 134 135 public boolean isRegistered(Class javaType, QName xmlType) { 136 boolean result = delegate.isRegistered(javaType, xmlType); 137 if (result == false && next != null) { 138 return next.isRegistered(javaType, xmlType); 139 } 140 return result; 141 } 142 143 144 145 150 public QName getTypeQName(Class javaType) { 151 return delegate.getTypeQName(javaType, next); 152 } 153 154 159 public Class getClassForQName(QName xmlType) { 160 return getClassForQName(xmlType, null); 161 } 162 163 169 public Class getClassForQName(QName xmlType, Class javaType) { 170 return delegate.getClassForQName(xmlType, javaType, next); 171 } 172 173 181 public QName getTypeQNameExact(Class javaType) { 182 QName result = delegate.getTypeQNameExact(javaType, next); 183 184 return result; 185 } 186 187 190 public void setNext(TypeMappingDelegate next) { 191 if (next == this) { 192 return; } 194 this.next = next; 195 } 196 197 200 public TypeMappingDelegate getNext() { 201 return next; 202 } 203 204 207 public Class [] getAllClasses() { 208 return delegate.getAllClasses(next); 209 } 210 211 228 public QName getXMLType(Class javaType, QName xmlType, boolean encoded) 229 throws JAXRPCException { 230 QName result = delegate.getXMLType(javaType, xmlType, encoded); 231 if (result == null && next != null) { 232 return next.getXMLType(javaType, xmlType, encoded); 233 } 234 return result; 235 } 236 237 public void setDoAutoTypes(boolean doAutoTypes) { 238 delegate.setDoAutoTypes(doAutoTypes); 239 } 240 } 241 | Popular Tags |