/** * 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); }
/** * 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); }
/** * 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); }
XStream xstream = new XStream(); xstream.aliasPackage("", "com.example");
public static Object fromXml(XStream xstream, String xml, String packageNameOld, String packageNameNew) { xstream.aliasPackage(packageNameOld, packageNameNew); return fromXml(xstream, xml); } }
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)); }
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); }
/** * 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; }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }