2021SC@SDUSC
// BackupImport.java public void performImport(InputStream is) throws Exception { ... // 上面的代码已经分析过,就省略了 // 下面的代码使用了Simple框架(Java Bean<->XML 之间序列化和反序列化的轻量级工具)通过注册转换器来序列化第三方对象 Registry registry = new Registry(); // RegistryStrategy允许在类和转换器之间注册绑定 Strategy strategy = new RegistryStrategy(registry); RegistryMatcher matcher = new RegistryMatcher(); Serializer simpleSerializer = new Persister(strategy, matcher); matcher.bind(Long.class, LongTransform.class); registry.bind(Date.class, DateConverter.class); ...
Simple是一个在Java Bean与XML之间序列化和反序列化的轻量级工具
官网地址:http://simple.sourceforge.net/home.php