当前位置: 首页>>代码示例>>Java>>正文


Java XStreamMarshaller.setAliases方法代码示例

本文整理汇总了Java中org.springframework.oxm.xstream.XStreamMarshaller.setAliases方法的典型用法代码示例。如果您正苦于以下问题:Java XStreamMarshaller.setAliases方法的具体用法?Java XStreamMarshaller.setAliases怎么用?Java XStreamMarshaller.setAliases使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.oxm.xstream.XStreamMarshaller的用法示例。


在下文中一共展示了XStreamMarshaller.setAliases方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.springframework.oxm.xstream.XStreamMarshaller; //导入方法依赖的package包/类
/**
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
	writer = new StaxEventItemWriter();
	writer.setResource(new FileSystemResource("target/test-outputs/StaxWriterTest.xml"));
	writer.setRootTagName("urlset");
	XStreamMarshaller marshaller = new XStreamMarshaller();

	Map<String, Object> aliases = new HashMap<String, Object>();
	aliases.put("url", Url.class);
	marshaller.setAliases(aliases);
	writer.setMarshaller(marshaller);
	Map<String, String> attributes = new HashMap<String, String>();
	attributes.put("xmlns", "http://www.sitemaps.org/schemas/sitemap");
	writer.setRootElementAttributes(attributes);

}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:20,代码来源:StaxWriterTest.java

示例2: registerXStreamMarshaller

import org.springframework.oxm.xstream.XStreamMarshaller; //导入方法依赖的package包/类
public void registerXStreamMarshaller(XStreamMarshaller marshaller, ResourceRegister register) throws Exception {
    marshaller.setSupportedClasses(register.getTargetClasses());
    if (!register.isEmpty()) {
        Collection<ClassDescriptor> cls = register.getClassDescriptors();
        Map<String, Class<?>> aliases = new HashMap<String, Class<?>>();
        Map<Class<?>, String> omittedFields = new HashMap<Class<?>, String>();
        for (ClassDescriptor cl : cls) {
            Class<?> clazz = cl.getTargetClass();
            String name = cl.getName();
            if (!StringUtils.hasLength(name))
                name = clazz.getSimpleName();
            aliases.put(name, clazz);
            Collection<String> fields = cl.getExcludesFields();
            for (String fieldName : fields) {
                omittedFields.put(clazz, fieldName);
            }

        }
        marshaller.setOmittedFields(omittedFields);
        marshaller.setAliases(aliases);
    }

}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:24,代码来源:OxmConverter.java

示例3: getMarshallingXmlViewResolver

import org.springframework.oxm.xstream.XStreamMarshaller; //导入方法依赖的package包/类
@Bean
  public CustomXMLViewResolver getMarshallingXmlViewResolver() { // Resolver para o formato XML
      //Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
      //marshaller.setClassesToBeBound(Product.class);
XStreamMarshaller marshaller = new XStreamMarshaller();
HashMap<String, Class<?>> keys = new HashMap<String,Class<?>>();
//keys.put("product", Product.class);
//keys.put("price", Price.class);
marshaller.setAliases(keys);
      return new CustomXMLViewResolver(marshaller);
  }
 
开发者ID:nailtonvieira,项目名称:pswot-cloud-java-spring-webapp,代码行数:12,代码来源:AppWebConfiguration.java

示例4: productMarshaller

import org.springframework.oxm.xstream.XStreamMarshaller; //导入方法依赖的package包/类
@Bean
public XStreamMarshaller productMarshaller() {

	HashMap<String, Class> aliases = new HashMap<String, Class>();
	aliases.put("product", Product.class);

	XStreamMarshaller marshaller = new XStreamMarshaller();
	try {
		marshaller.setAliases(aliases);
	} catch (Exception ignored) {}

	return marshaller;
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:14,代码来源:JobXmlFileConfiguration.java


注:本文中的org.springframework.oxm.xstream.XStreamMarshaller.setAliases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。