Examples of JsonHierarchicalStreamDriver


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

    public void testJson() {
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setName("foo");

        XStreamDataFormat xStreamDataFormat = new XStreamDataFormat();
        xStreamDataFormat.setXstreamDriver(new JsonHierarchicalStreamDriver());

        XStream xStream = xStreamDataFormat.createXStream(new DefaultClassResolver());
        String marshalledOrder = xStream.toXML(purchaseOrder);

        assertEquals("{", marshalledOrder.substring(0, 1));
View Full Code Here

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

     * 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);
    }
View Full Code Here

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

     * 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);
    }
View Full Code Here

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

  private boolean includeSelected = false;
  private Object  selectedValue;


  public ExtJSJsonImpl(HttpServletResponse response) {
    this.xstream  = new XStream(new JsonHierarchicalStreamDriver());
    this.response = response;
  }
View Full Code Here

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

    public JobDataMap getJobData() {
        return jobData;
    }

    public void storeJSONData(String jsonData) {
        XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
        jobData = (JobDataMap) xstream.fromXML(jsonData);
    }
View Full Code Here

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

        XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
        jobData = (JobDataMap) xstream.fromXML(jsonData);
    }

    public String getJSONData() {
        XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
        String jsonData = xstream.toXML(jobData);
        return jsonData;
    }
View Full Code Here

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

                from("direct:marshal-json").marshal(xstreamDefinition).to("mock:result");
                from("direct:unmarshal-json").unmarshal(xstreamDefinition).to("mock:result");
               
                org.apache.camel.dataformat.xstream.XStreamDataFormat xStreamDataFormat
                    = new org.apache.camel.dataformat.xstream.XStreamDataFormat();
                xStreamDataFormat.setXstreamDriver(new JsonHierarchicalStreamDriver());
                from("direct:myDriver").marshal(xStreamDataFormat).to("mock:result");
            }
        };
    }
View Full Code Here

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

     * @param jqPlot
     * @return
     */
    public static String jqPlotToJson(ChartConfiguration jqPlot) {

        XStream xstream = new XStream(new JsonHierarchicalStreamDriver() {

            @Override
            public HierarchicalStreamWriter createWriter(Writer writer) {
                return new JqPlotJsonMapHierarchicalWriter(writer, JsonWriter.DROP_ROOT_MODE) {

View Full Code Here

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

public class BindUtil {

  public static String toJsonWorkFlowBean(WorkFlowBean workFlowBean) {
    // XStream xStream = new XStream(new JsonHierarchicalStreamDriver());
    XStream xStream = new XStream(new JsonHierarchicalStreamDriver()) {
      @Override
      protected MapperWrapper wrapMapper(MapperWrapper next) {
        return new MapperWrapper(next) {
          @Override
          public boolean shouldSerializeMember(Class definedIn, String fieldName) {
View Full Code Here

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

    */
  protected HierarchicalStreamDriver getHierarchicalStreamDriver() {
  final String newLine = (indented ? INDENTED_NEW_LINE : DEFAULT_NEW_LINE);
  final char[] lineIndenter = (indented ? INDENTED_LINE_INDENTER : DEFAULT_LINE_INDENTER);

  return new JsonHierarchicalStreamDriver() {
    public HierarchicalStreamWriter createWriter(Writer writer) {
    if (withoutRoot) {
      return new JsonWriter(writer, lineIndenter, newLine, JsonWriter.DROP_ROOT_MODE);
    }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.