1 9 package org.nanocontainer.script.xml; 10 11 import org.picocontainer.PicoContainer; 12 import org.w3c.dom.Element ; 13 14 import com.thoughtworks.xstream.XStream; 15 import com.thoughtworks.xstream.io.xml.DomDriver; 16 import com.thoughtworks.xstream.io.xml.DomReader; 17 18 26 public class XStreamComponentInstanceFactory implements XMLComponentInstanceFactory { 27 28 private XStream xstream; 29 30 34 public XStreamComponentInstanceFactory(){ 35 this(new XStream(new DomDriver())); 36 } 37 38 43 public XStreamComponentInstanceFactory(XStream xstream){ 44 this.xstream = xstream; 45 } 46 47 52 public Object makeInstance(PicoContainer pico, Element element, ClassLoader classLoader) throws ClassNotFoundException { 53 return xstream.unmarshal(new DomReader(element)); 54 } 55 } 56 | Popular Tags |