Package com.thoughtworks.xstream.io.json

Examples of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver


  public WizardUIInfo load(InputStream jsonDescriptionInputStream) throws IOException {
    return load(new InputStreamReader(jsonDescriptionInputStream));
  }

  public WizardUIInfo load(Reader jsonDescriptionReader) throws IOException {
    XStream xstream = new XStream(new JettisonMappedXmlDriver());
    xstream.alias("info", WizardUIInfo.class);
    xstream.alias("element", WizardUIInfoElement.class);
    xstream.alias("page", WizardUIInfoPage.class);
    return (WizardUIInfo) xstream.fromXML(jsonDescriptionReader);
  }
View Full Code Here


import java.util.Map;
import java.util.Map.Entry;

public class XStreamJSon {
    public static XStream newJSonMarshaller() {
        JettisonMappedXmlDriver jet = new JettisonMappedXmlDriver();
        XStream xstream = new XStream( jet );

        XStreamHelper.setAliases( xstream );

        xstream.alias( "commands",
View Full Code Here

        try {
            if (formatExtension.equalsIgnoreCase("xml")) {
                newLayer = (TileLayer) xs.fromXML(is);
            } else if (formatExtension.equalsIgnoreCase("json")) {
                HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
                HierarchicalStreamReader hsr = driver.createReader(is);
                // See http://jira.codehaus.org/browse/JETTISON-48
                StringWriter writer = new StringWriter();
                new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(writer));
                writer.close();
                newLayer = (TileLayer) xs.fromXML(writer.toString());
View Full Code Here

     *
     * The code below is a hack: it treats the json string as text, then converts it to the
     * intermediate xml and then deserializes that into the SeedRequest object.
     */
    private String convertJson(String entityText) throws IOException {
        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
        StringReader reader = new StringReader(entityText);
        HierarchicalStreamReader hsr = driver.createReader(reader);
        StringWriter writer = new StringWriter();
        new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(writer));
        writer.close();
        return writer.toString();
    }
View Full Code Here

    private DiskQuotaConfig fromJSON(Representation entity) throws IOException {

        final String text = entity.getText();

        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();

        XStream xStream = new XStream(driver);

        xStream = ConfigLoader.getConfiguredXStream(xStream);
View Full Code Here

   * @param json
   *            the json string
   * @return the string as xml.
   */
  public static String fromJSONtoXML(String json) {
    HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
    StringReader reader = new StringReader(json);
    HierarchicalStreamReader hsr = driver.createReader(reader);
    StringWriter writer = new StringWriter();
    try {
      new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(
          writer));
      return writer.toString();
View Full Code Here

  private static <T> T serializer(Object object,
      boolean isJSON, boolean isSerialize) {
    XStream serializer;
    if (isJSON) {
      // Serializador JSON
      serializer = new XStream(new JettisonMappedXmlDriver());
    } else {
      // Serializador XML
      serializer = new XStream(new DomDriver());
    }
    // Processa automaticamente as anotacoes presentes nos modelos.
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.