1 8 9 package mx4j.tools.remote.soap.axis.ser; 10 11 import java.lang.reflect.Constructor ; 12 13 import org.xml.sax.SAXException ; 14 15 18 public class PrincipalDeser extends AxisDeserializer 19 { 20 private String className; 21 private String name; 22 23 public void onSetChildValue(Object value, Object hint) throws SAXException 24 { 25 if (PrincipalSer.CLASS_NAME.equals(hint)) 26 className = (String )value; 27 else if (PrincipalSer.NAME.equals(hint)) name = (String )value; 28 } 29 30 protected Object createObject() throws SAXException 31 { 32 try 33 { 34 Class principalClass = Thread.currentThread().getContextClassLoader().loadClass(className); 35 Constructor ctor = principalClass.getConstructor(new Class []{String .class}); 36 return ctor.newInstance(new Object []{name}); 37 } 38 catch (Exception x) 39 { 40 throw new SAXException (x); 41 } 42 } 43 } 44 | Popular Tags |