本文整理了Java中com.thoughtworks.xstream.XStream.setMarshallingStrategy()
方法的一些代码示例,展示了XStream.setMarshallingStrategy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.setMarshallingStrategy()
方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:setMarshallingStrategy
[英]Setter for an arbitrary marshalling strategy.
[中]任意编组策略的设定器。
代码示例来源:origin: spring-projects/spring-framework
xstream.setMarshallingStrategy(this.marshallingStrategy);
代码示例来源:origin: com.thoughtworks.xstream/xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: org.jvnet.hudson/xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
代码示例来源:origin: ovea-deprecated/jetty-session-redis
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
代码示例来源:origin: com.coherentlogic.enterprise-data-adapter/xstream-int
@Override
protected void customizeXStream(XStream xstream) {
super.customizeXStream(xstream);
xstream.setMarshallingStrategy(
new CustomMarshallingStrategy ()
);
}
}
代码示例来源:origin: com.coherentlogic.coherent.data-model/data-adapter-core
@Override
protected void customizeXStream(XStream xstream) {
super.customizeXStream(xstream);
xstream.setMarshallingStrategy(
new CustomMarshallingStrategy ()
);
}
}
代码示例来源:origin: com.haulmont.thirdparty/xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: apache/servicemix-bundles
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: x-stream/xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: org.sonatype.nexus.xstream/xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream
switch (mode) {
case NO_REFERENCES:
setMarshallingStrategy(new TreeMarshallingStrategy());
break;
case ID_REFERENCES:
setMarshallingStrategy(new ReferenceByIdMarshallingStrategy());
break;
case XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE));
break;
case XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE));
break;
case SINGLE_NODE_XPATH_RELATIVE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.RELATIVE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
break;
case SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES:
setMarshallingStrategy(new ReferenceByXPathMarshallingStrategy(
ReferenceByXPathMarshallingStrategy.ABSOLUTE
| ReferenceByXPathMarshallingStrategy.SINGLE_NODE));
代码示例来源:origin: riotfamily/riot
public void afterPropertiesSet() throws Exception {
if (driver == null) {
driver = new DomDriver("UTF-8");
}
xstream = new XStream(driver) {
@Override
protected MapperWrapper wrapMapper(MapperWrapper next) {
return new HibernateProxyMapper(next);
}
};
xstream.alias("component", Component.class);
xstream.alias("component-list", ComponentList.class);
xstream.alias("content-map", ContentMapImpl.class);
xstream.alias("virtual-page", VirtualPage.class);
Mapper mapper = xstream.getMapper();
xstream.registerConverter(new HibernateEntityConverter(mapper,
applicationContext), 1);
xstream.registerConverter(new ComponentListConverter(mapper), 1);
xstream.registerConverter(new ComponentConverter(mapper), 2);
xstream.registerConverter(new ContentMapConverter(mapper), 1);
xstream.registerConverter(new VirtualPageConverter(), 1);
xstream.setMarshallingStrategy(new NullSafeXPathMarshallingStrategy());
}
代码示例来源:origin: micromata/projectforge
xstream.setMarshallingStrategy(new ReferenceByIdMarshallingStrategy()
代码示例来源:origin: micromata/projectforge
stream.setMarshallingStrategy(marshallingStrategy);
stream.marshal(all, new PrettyPrintWriter(writer));
代码示例来源:origin: apache/servicemix-bundles
xstream.setMarshallingStrategy(this.marshallingStrategy);
代码示例来源:origin: micromata/projectforge
/**
* @return
*/
private XStream initXStream(final Session session, final boolean nullifyPk)
{
final XStream xstream = new XStream()
{
@Override
protected MapperWrapper wrapMapper(final MapperWrapper next)
{
return new HibernateMapper(new HibernateCollectionsMapper(next));
}
};
// Converter für die Hibernate-Collections
xstream.registerConverter(new HibernateCollectionConverter(xstream.getConverterLookup()));
xstream.registerConverter(
new HibernateProxyConverter(xstream.getMapper(), new PureJavaReflectionProvider(),
xstream.getConverterLookup()),
XStream.PRIORITY_VERY_HIGH);
xstream.setMarshallingStrategy(new XStreamMarshallingStrategy(XStreamMarshallingStrategy.RELATIVE));
init(xstream);
return xstream;
}
}
内容来源于网络,如有侵权,请联系作者删除!