Package org.apache.shindig.social.core.util.xstream.XStreamConfiguration

Examples of org.apache.shindig.social.core.util.xstream.XStreamConfiguration.ConverterConfig


  private String convertToXml(Object obj) {

    writerStack.reset();
    if (obj instanceof Map) {
      Map<?, ?> m = (Map<?, ?>) obj;
      ConverterConfig cc = converterMap
          .get(XStreamConfiguration.ConverterSet.MAP);
      if (m.size() == 1) {
        Object s = m.values().iterator().next();
        cc.mapper.setBaseObject(s); // thread safe method
        String result = cc.xstream.toXML(s);
        log.debug("Result is " + result);
        return "<response>" + result + "</response>";
      }
    } else if (obj instanceof RestfulCollection) {
      ConverterConfig cc = converterMap
          .get(XStreamConfiguration.ConverterSet.COLLECTION);
      cc.mapper.setBaseObject(obj); // thread safe method
      String result = cc.xstream.toXML(obj);
      log.debug("Result is " + result);
      return result;
    } else if (obj instanceof DataCollection) {
      ConverterConfig cc = converterMap
          .get(XStreamConfiguration.ConverterSet.MAP);
      cc.mapper.setBaseObject(obj); // thread safe method
      String result = cc.xstream.toXML(obj);
      log.debug("Result is " + result);
      return result;
    }
    ConverterConfig cc = converterMap
        .get(XStreamConfiguration.ConverterSet.DEFAULT);

    cc.mapper.setBaseObject(obj); // thread safe method
    String result = cc.xstream.toXML(obj);
    log.debug("Result is " + result);
View Full Code Here


    return "<response>" + result + "</response>";
  }

  @SuppressWarnings("unchecked")
  public <T> T convertToObject(String xml, Class<T> className) {
    ConverterConfig cc = converterMap.get(XStreamConfiguration.ConverterSet.DEFAULT);
    return (T) cc.xstream.fromXML(xml);
  }
View Full Code Here

   */
  @Override
  public String convertToString(Object obj) {
    writerStack.reset();
    AtomFeed af = new AtomFeed(obj);
    ConverterConfig cc = converterMap
        .get(XStreamConfiguration.ConverterSet.DEFAULT);
    cc.mapper.setBaseObject(af); // thread safe method
    String result = cc.xstream.toXML(af);
   
    return result;
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.core.util.xstream.XStreamConfiguration.ConverterConfig

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.