public static <T extends Model> Page<T> newInstance(Class<T> modelClass, InputStream in) { XMLFactory factory = new XMLFactory(Page.class, modelClass); try { return factory.unmarshal(in); } catch (Exception e) { log.error("生成对象出错", e); } return null; }
public String toXml() { XMLFactory factory = new XMLFactory(Page.class, getModelClass()); String xml = null; try { xml = factory.marshal(this); } catch (Exception e) { log.error("生成XML出错", e); } return xml; }