本文整理了Java中com.thoughtworks.xstream.XStream.aliasPackage()
方法的一些代码示例,展示了XStream.aliasPackage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.aliasPackage()
方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:aliasPackage
[英]Alias a package to a shorter name to be used in XML elements.
[中]将包别名为要在XML元素中使用的较短名称。
代码示例来源:origin: AxonFramework/AxonFramework
/**
* Add an alias for a package. This allows long package names to be shortened considerably. Will also use the alias
* for sub-packages of the provided package.
* <p/>
* E.g. an alias of "axoncore" for the package "org.axonframework.core" will use "axoncore.repository" for the
* package "org.axonframework.core.repository".
*
* @param alias The alias to use.
* @param pkgName The package to use the alias for
* @see XStream#aliasPackage(String, String)
*/
public void addPackageAlias(String alias, String pkgName) {
xStream.aliasPackage(alias, pkgName);
}
代码示例来源:origin: org.axonframework/axon-core
/**
* Add an alias for a package. This allows long package names to be shortened considerably. Will also use the alias
* for sub-packages of the provided package.
* <p/>
* E.g. an alias of "axoncore" for the package "org.axonframework.core" will use "axoncore.repository" for the
* package "org.axonframework.core.repository".
*
* @param alias The alias to use.
* @param pkgName The package to use the alias for
* @see XStream#aliasPackage(String, String)
*/
public void addPackageAlias(String alias, String pkgName) {
xStream.aliasPackage(alias, pkgName);
}
代码示例来源:origin: org.axonframework/axon-messaging
/**
* Add an alias for a package. This allows long package names to be shortened considerably. Will also use the alias
* for sub-packages of the provided package.
* <p/>
* E.g. an alias of "axoncore" for the package "org.axonframework.core" will use "axoncore.repository" for the
* package "org.axonframework.core.repository".
*
* @param alias The alias to use.
* @param pkgName The package to use the alias for
* @see XStream#aliasPackage(String, String)
*/
public void addPackageAlias(String alias, String pkgName) {
xStream.aliasPackage(alias, pkgName);
}
代码示例来源:origin: stackoverflow.com
XStream xstream = new XStream();
xstream.aliasPackage("", "com.example");
代码示例来源:origin: micromata/projectforge
public static Object fromXml(XStream xstream, String xml, String packageNameOld, String packageNameNew)
{
xstream.aliasPackage(packageNameOld, packageNameNew);
return fromXml(xstream, xml);
}
}
代码示例来源:origin: narfman0/GDXWorld
public AbstractXStreamSerializer(XStream xStream, String extension, String name){
this.xStream = xStream;
this.extension = extension;
this.name = name;
xStream.alias("Vector2", com.badlogic.gdx.math.Vector2.class);
xStream.aliasPackage("world", "com.blastedstudios.gdxworld.world");
xStream.aliasPackage("plugin", "com.blastedstudios.gdxworld.plugin");
if(Properties.getBool("levelconverter.marshal.use", false))
xStream.registerConverter(new LevelConverter(xStream));
}
代码示例来源:origin: org.aperteworkflow/integration
private Collection<ProcessRoleConfig> getRoles(InputStream input) {
if (input == null) {
return null;
}
XStream xstream = new XStream();
xstream.aliasPackage("config", ProcessRoleConfig.class.getPackage().getName());
xstream.useAttributeFor(String.class);
xstream.useAttributeFor(Boolean.class);
xstream.useAttributeFor(Integer.class);
return (Collection<ProcessRoleConfig>) xstream.fromXML(input);
}
代码示例来源:origin: uk.ac.gate.mimir/mimir-core
/**
* Creates an XStream object suitable for loading and saving Mimir index
* configurations.
*/
private static XStream newXStream() {
XStream xs = new XStream(new StaxDriver());
xs.setClassLoader(Gate.getClassLoader());
xs.alias("indexConfig", IndexConfig.class);
xs.alias("tokenIndexer", TokenIndexerConfig.class);
xs.alias("semanticIndexer", SemanticIndexerConfig.class);
// when loading old indexes, add the '.big.'
xs.aliasPackage("it.unimi.dsi.mg4j", "it.unimi.di.big.mg4j");
// when loading pre-5.0 indexes, replace the package name
xs.aliasPackage("it.unimi.dsi.big.mg4j", "it.unimi.di.big.mg4j");
return xs;
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
/**
* Return an Advisory message as a JSON formatted string
*
* @param ds the DataStructure instance that is being marshaled.
* @return the JSON marshaled form of the given DataStructure instance.
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: pierre/meteo
/**
* Return an Advisory message as a JSON formatted string
* @param ds
* @return
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
/**
* Return an Advisory message as a JSON formatted string
*
* @param ds the DataStructure instance that is being marshaled.
* @return the JSON marshaled form of the given DataStructure instance.
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
/**
* Return an Advisory message as a JSON formatted string
*
* @param ds
* the DataStructure instance that is being marshaled.
*
* @return the JSON marshaled form of the given DataStructure instance.
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* Return an Advisory message as a JSON formatted string
*
* @param ds
* the DataStructure instance that is being marshaled.
*
* @return the JSON marshaled form of the given DataStructure instance.
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: org.apache.activemq/activemq-stomp
/**
* Return an Advisory message as a JSON formatted string
*
* @param ds
* the DataStructure instance that is being marshaled.
*
* @return the JSON marshaled form of the given DataStructure instance.
*/
protected String marshallAdvisory(final DataStructure ds) {
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
return xstream.toXML(ds);
}
}
代码示例来源:origin: org.apache.activemq/activemq-stomp
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
代码示例来源:origin: org.apache.activemq/activemq-all
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase(Locale.ENGLISH).endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
代码示例来源:origin: pierre/meteo
protected String marshallAdvisory(final DataStructure ds, String transformation) {
StringWriter buffer = new StringWriter();
HierarchicalStreamWriter out;
if (transformation.toLowerCase().endsWith("json")) {
out = new JettisonMappedXmlDriver().createWriter(buffer);
} else {
out = new PrettyPrintWriter(buffer);
}
XStream xstream = getXStream();
xstream.setMode(XStream.NO_REFERENCES);
xstream.aliasPackage("", "org.apache.activemq.command");
xstream.marshal(ds, out);
return buffer.toString();
}
内容来源于网络,如有侵权,请联系作者删除!