package com.nbtconsulting.demo.restws.v2007.model.util.xml; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; import com.thoughtworks.xstream.mapper.MapperWrapper; import com.nbtconsulting.demo.restws.v2007.model.*; import com.nbtconsulting.demo.restws.v2007.model.util.xml.HibernateMapper; import com.nbtconsulting.demo.restws.v2007.model.util.xml.HibernateProxyConverter; import com.nbtconsulting.demo.restws.v2007.modelhbm.*; //--------------------------------------------------------- //--------------------------------------------------------- /* Created 09/18/2007 richardh */ /** */ public class XStreamCustomFactoryImpl //extends implements java.io.Serializable { //--------------------------------------------------------- public XStreamCustomFactoryImpl() { } //--------------------------------------------------------- public static XStream getXStreamInstance() { XStream xstream = new XStream() { protected MapperWrapper wrapMapper(MapperWrapper next) { return new HibernateMapper(next); } }; xstream.registerConverter( new HibernateProxyConverter(xstream.getMapper(), new PureJavaReflectionProvider()), XStream.PRIORITY_VERY_HIGH); /* //com.nbtconsulting.demo.restws.v2007.modelhbm.School xstream.alias("school", School.class); xstream.alias("school-collection", SchoolCollection.class); xstream.alias("student", Student.class); xstream.alias("student-collection", StudentCollection.class); xstream.alias("instructor", Instructor.class); xstream.alias("instructor-collection", InstructorCollection.class); */ return xstream; } }