Examples of JsonConfig


Examples of de.mhus.lib.config.JsonConfig

          "{'test1':'wow1','test2':'alf1'} , " +
          "{'test1':'wow2','test2':'alf2'} , " +
          "{'test1':'wow3','test2':'alf3'}  " +
        "] }", "'", "\"");
   
    JsonConfig c = new JsonConfig(json);
   
    derTeschd(c, true);
  }
View Full Code Here

Examples of de.mhus.lib.config.JsonConfig

    Document doc = MXml.loadXml(xml);
   
    XmlConfig src = new XmlConfig(doc.getDocumentElement());

    HashConfig tar1 = new HashConfig();
    JsonConfig tar2 = new JsonConfig();
    XmlConfig  tar3 = new XmlConfig();
   
    builder.cloneConfig(src, tar1);
    builder.cloneConfig(src, tar2);
    builder.cloneConfig(src, tar3);
View Full Code Here

Examples of net.sf.json.JsonConfig

import org.jrest4guice.rest.commons.json.annotations.JsonExclude;

public class JsonConfigFactory {
  public static JsonConfig createJsonConfig(Object bean) {
    JsonConfig jsonConfig = new JsonConfig();
    if(bean == null)
      return jsonConfig;
    if (bean instanceof List) {
      try {
        bean = ((List<?>) bean).get(0);
View Full Code Here

Examples of net.sf.json.JsonConfig

    return new XMLSerializer().write(JSONObject.fromObject(this,
        JsonConfigFactory.createJsonConfig(this.content)));
  }

  public String toJson() {
    JsonConfig jsonConfig = JsonConfigFactory.createJsonConfig(this.content);
   
    jsonConfig.registerJsonValueProcessor(Date.class,new DateJsonValueProcessor());
    jsonConfig.registerJsonValueProcessor(Timestamp.class,new DateJsonValueProcessor())

    JsonConfigFactory.filteExcludes(this, jsonConfig);
    return JSONObject.fromObject(this,
        jsonConfig).toString();
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

    }

    protected JSONOutPutConfig config = new JSONOutPutConfig();

    public JSON _toJson(Object obj) {
        JsonConfig config = new JsonConfig();
        config.setIgnoreDefaultExcludes(false);
        config.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
        config.registerJsonValueProcessor(Date.class, new DateJsonValueProcessor());
        if (obj instanceof Collection) {
            return JSONArray.fromObject(obj, config);
        }
        return JSONObject.fromObject(obj, config);
    }
View Full Code Here

Examples of net.sf.json.JsonConfig

  public synchronized EventRunner send(JSONPacket command) throws JSONException,IOException{
    logger.info("Sending: "+command.getClass().getSimpleName()+": "+command);
    String response = put(command.toString());
    logger.info("Received: "+response.trim()+" after "+command.getClass().getSimpleName());
    JsonConfig jsonConfig = new JsonConfig();
    jsonConfig.setExcludes(new String[]{"cookie", "length"});
    final JSONArray jsonResponse = (JSONArray) JSONSerializer.toJSON(response,jsonConfig);
    return signalEvents(jsonResponse);
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

  private EventRunner signalEvents(JSONArray jsonResponse) throws JSONException{
    final JSONPacket[] events = new JSONPacket[jsonResponse.size()];
    for(int i=0; i<jsonResponse.size();i++){
      JSONObject jsonEvent = jsonResponse.getJSONObject(i);
      JsonConfig jsonConfig = new JsonConfig();
      jsonConfig.setRootClass( eventTypes.get(jsonEvent.get("type")) );
      try {
        events[i]=(JSONPacket) JSONObject.toBean( jsonEvent, jsonConfig );
      } catch (ClassCastException e) {
        throw new IllegalStateException("Couldn't unmarshall: "+jsonEvent,e);
      }
View Full Code Here

Examples of net.sf.json.JsonConfig

    writer.close();
  }

  protected void writeMap(Map<?, ?> map) throws IOException
  {
    JsonConfig config = new JsonConfig();
    config.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
    String json = JSONObject.fromObject(map, config).toString();
    writeInResponse(json);
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

            sb.append(buffer, 0, len);
        }
        if (target != null && sb.length() > 0 && sb.charAt(0) == '[') {
            JSONArray jsonArray = JSONArray.fromObject(sb.toString());
            if (target.getClass().isArray()) {
                JSONArray.toArray(jsonArray, target, new JsonConfig());
            } else {
                JSONArray.toList(jsonArray, target, new JsonConfig());
            }

        } else {
            JSONObject jsonObject = JSONObject.fromObject(sb.toString());
            JSONObject.toBean(jsonObject, target, new JsonConfig());
        }
    }
View Full Code Here

Examples of net.sf.json.JsonConfig

            sb.append(buffer, 0, len);
        }
        if (target != null && sb.length() > 0 && sb.charAt(0) == '[') {
            JSONArray jsonArray = JSONArray.fromObject(sb.toString());
            if (target.getClass().isArray()) {
                JSONArray.toArray(jsonArray, target, new JsonConfig());
            } else {
                JSONArray.toList(jsonArray, target, new JsonConfig());
            }

        } else {
            JSONObject jsonObject = JSONObject.fromObject(sb.toString());
            JSONObject.toBean(jsonObject, target, new JsonConfig());
        }
    }
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.