Package flexjson

Examples of flexjson.JSONSerializer


    }
   
    @Override
    public String serializeObject(Object o)
    {
        JSONSerializer S = new JSONSerializer().include("*").exclude("class");
       
        Log.log("Serialized obj : " + S.deepSerialize(o));
       
        return S.deepSerialize(o);
    }
View Full Code Here


        sb.append("Title: ").append(getTitle());
        return sb.toString();
    }
   
    public String toJson() {
        return new JSONSerializer().exclude("*.class", "*.persistentState", "*.entityState").serialize(this);
    }   
View Full Code Here

    public String toJson() {
        return new JSONSerializer().exclude("*.class", "*.persistentState", "*.entityState").serialize(this);
    }   

    public static String toJsonArray(Iterable<Todo> collection) {
        return new JSONSerializer().exclude("*.class", "*.persistentState", "*.entityState").serialize(collection);
    }
View Full Code Here

  public static Object[] getArrayByJSon(String jsonStr, Class[] classTypes) {
    int indexArrayObjects = 0;

    List<Object> arrayObjects = new JSONDeserializer<List<Object>>().deserialize(jsonStr);
    Object[] objects = new Object[arrayObjects.size()];
    JSONSerializer serializer = new JSONSerializer();

    for (int i = 0; i < objects.length; i++) {
      String part = serializer.exclude("*.class").serialize(arrayObjects.get(i));
      if (part.startsWith("[")) {
        Object[] objs = getArrayByJSon(part, new Class[] { classTypes[indexArrayObjects] });
        objects[i] = objs;
      } else
        objects[i] = new JSONDeserializer().use(null, classTypes[indexArrayObjects]).deserialize(part);
View Full Code Here

    return objects;
  }

  public static String SerializeJSObject(Object objeto) {
    return new JSONSerializer().exclude("*.class").deepSerialize(objeto);
  }
 
View Full Code Here

  }

  @Override
  public String getAsString(final FacesContext context,
      final UIComponent component, final Object value) {
    return new JSONSerializer().exclude("*.class").serialize(value);
  }
 
View Full Code Here

  /**
   * @{inheritDoc}
   */
  public void store(Item item, String alias) {
    if (initialized) {
      JSONSerializer serializer =
        new JSONSerializer().transform(new SenseEventTransformer(), SenseEventBean.class);
      String serializedBean = serializer.serialize(new SenseEventBean(alias, item.getState().toString()));
     
      String serviceUrl = url + apiKey;
      String response = HttpUtil.executeUrl(
        "POST", serviceUrl, IOUtils.toInputStream(serializedBean), "application/json", 5000);
      logger.debug("Stored item '{}' as '{}' in Sen.se and received response: {} ", new String[] { item.getName(), alias, response });
View Full Code Here

              httpCon.setRequestMethod("PUT");
              httpCon.setRequestProperty("Content-type", "application/json");
              httpCon.setRequestProperty("X-ApiKey",apiKey);
              OutputStreamWriter out = new OutputStreamWriter(httpCon.getOutputStream());

        JSONSerializer serializer =
          new JSONSerializer().transform(new CosmEventTransformer(), CosmEventBean.class);
        String serializedBean = serializer.serialize(new CosmEventBean(alias, item.getState().toString()));

              out.write(serializedBean);
              out.flush();
        logger.debug("Stored item '{}' as '{}' in Cosm and received response: {} ", new String[] { item.getName(), alias, httpCon.getResponseMessage() });
              out.close();
View Full Code Here

TOP

Related Classes of flexjson.JSONSerializer

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.