1 55 56 package org.jboss.axis.encoding.ser; 57 58 import javax.xml.namespace.QName ; 59 import java.beans.IntrospectionException ; 60 import java.lang.reflect.Method ; 61 62 68 public class EnumDeserializer extends SimpleDeserializer 69 { 70 71 private Method fromStringMethod = null; 72 73 public EnumDeserializer(Class javaType, QName xmlType) 74 { 75 super(javaType, xmlType); 76 } 77 78 public Object makeValue(String source) throws Exception 79 { 80 if (isNil) 82 return null; 83 if (fromStringMethod == null) 84 { 85 try 86 { 87 fromStringMethod = javaType.getMethod("fromString", 88 new Class []{java.lang.String .class}); 89 } 90 catch (Exception e) 91 { 92 throw new IntrospectionException (e.toString()); 93 } 94 } 95 return fromStringMethod.invoke(null, new Object []{source}); 96 } 97 } 98 | Popular Tags |