1 16 17 package org.apache.axis.encoding.ser; 18 19 import javax.xml.namespace.QName ; 20 import java.beans.IntrospectionException ; 21 import java.lang.reflect.Method ; 22 23 import org.apache.axis.utils.cache.MethodCache; 24 25 31 public class EnumDeserializer extends SimpleDeserializer { 32 33 private Method fromStringMethod = null; 34 35 private static final Class [] STRING_CLASS = new Class [] { java.lang.String .class }; 36 37 public EnumDeserializer(Class javaType, QName xmlType) { 38 super(javaType, xmlType); 39 } 40 41 public Object makeValue(String source) throws Exception 42 { 43 if (isNil) 45 return null; 46 if (fromStringMethod == null) { 47 try { 48 fromStringMethod = MethodCache.getInstance().getMethod(javaType, "fromString", STRING_CLASS); 49 } catch (Exception e) { 50 throw new IntrospectionException (e.toString()); 51 } 52 } 53 return fromStringMethod.invoke(null,new Object [] { source }); 54 } 55 } 56 | Popular Tags |