Examples of JsonHierarchicalStreamDriver


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

  private XStream xstream;
  private ExtJSWrapper wrapper;

  public DefaultExtJson(HttpServletResponse response, TypeNameExtractor extractor, ProxyInitializer initializer)
  throws IOException {
  xstream = new XStream(new JsonHierarchicalStreamDriver() {
    @Override
    public HierarchicalStreamWriter createWriter(Writer writer) {
    return new JsonWriter(writer, new char[0], "", JsonWriter.DROP_ROOT_MODE) {
      @Override
      public void addAttribute(String key, String value) {
View Full Code Here

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

  private Object  selectedValue;
  private Integer totalValue;


  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 <T> Serializer from(T object, String alias) {
        final String newLine = (indented ? INDENTED_NEW_LINE : DEFAULT_NEW_LINE);
        final char[] lineIndenter = (indented ? INDENTED_LINE_INDENTER : DEFAULT_LINE_INDENTER);

        driver = new JsonHierarchicalStreamDriver() {
            public HierarchicalStreamWriter createWriter(Writer writer) {
                if (withoutRoot) {
                    return new JsonWriter(writer, lineIndenter, newLine, JsonWriter.DROP_ROOT_MODE);
                }
View Full Code Here

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

    when(restfulie.newRelationBuilder()).thenReturn(builder);

    Configuration config = mock(Configuration.class);
    when(config.getApplicationPath()).thenReturn("http://www.caelum.com.br");

    xstream = new XStream(new JsonHierarchicalStreamDriver());
    ReflectionConverter base = new ReflectionConverter(xstream.getMapper(), xstream.getReflectionProvider());

    xstream.registerConverter(new LinkConverterJSON(base, restfulie, config));
  }
View Full Code Here

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

    protected void printOutput(Object o, Class... classes) {
        XStream xstream = null;
        String format = getOutput();
        if (format.equals("json"))
            xstream = new XStream(new JsonHierarchicalStreamDriver());
        else if (format.equals("xml"))
            xstream = new XStream();
        else
            System.out.println(o.toString());
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

    assertEquals("Number is invalid", 42L, unflight.getFlightNumber());
  }

  @Test
  public void jsonDriver() throws Exception {
    marshaller.setStreamDriver(new JsonHierarchicalStreamDriver() {
      @Override
      public HierarchicalStreamWriter createWriter(Writer writer) {
        return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE,
            new JsonWriter.Format(new char[0], new char[0],
                JsonWriter.Format.SPACE_AFTER_LABEL | JsonWriter.Format.COMPACT_EMPTY_ELEMENT));
View Full Code Here

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

    protected void printOutput(Object o, Class... classes) {
        XStream xstream = null;
        String format = getOutput();
        if (format.equals("json"))
            xstream = new XStream(new JsonHierarchicalStreamDriver());
        else if (format.equals("xml"))
            xstream = new XStream();
        else
            System.out.println(o.toString());
View Full Code Here

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

  protected HierarchicalStreamDriver getHierarchicalStreamDriver() {
    return this.driver;
  }

  public <T> NoRootSerialization withoutRoot() {
    this.driver = new JsonHierarchicalStreamDriver() {
      @Override
      public HierarchicalStreamWriter createWriter(Writer writer) {
        return new JsonWriter(writer, JsonWriter.DROP_ROOT_MODE);
      }
    };
View Full Code Here

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

  /**
   * You can override this method for configuring Driver before serialization
   */
  protected HierarchicalStreamDriver getHierarchicalStreamDriver() {
    return new JsonHierarchicalStreamDriver();
  }
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.