Package org.json.simple.parser

Examples of org.json.simple.parser.ContainerFactory


      InputStream in = conn.getInputStream();
      BufferedReader reader = new BufferedReader(
          new InputStreamReader(in));
      String jsonText = reader.readLine();
      JSONParser parser = new JSONParser();
      ContainerFactory containerFactory = new ContainerFactory() {
        public List creatArrayContainer() {
          return new LinkedList();
        }

        public Map createObjectContainer() {
View Full Code Here


  private Response getResponseObject0p8(String json,
      final Class<? extends Model> modelClass) {
    Response response = new Response();

    JSONParser parser = new JSONParser();
    ContainerFactory containerFactory = getContainerFactory(modelClass);

    try {
      Map rootObject = (Map) parser.parse(json, containerFactory);

      if (rootObject.containsKey("startIndex")) {
View Full Code Here

  private Map<String, Response> getResponseMap0p8(String json,
      Map<String, Class<? extends Model>> modelClasses) {
    Map<String, Response> responses = new HashMap<String, Response>();

    JSONParser parser = new JSONParser();
    ContainerFactory containerFactory = getContainerFactory(Model.class);

    try {
      List<Map> rootArray = (List<Map>) parser.parse(json, containerFactory);

      for (Map responseObject : rootArray) {
View Full Code Here

  private Response getResponseObject0p9(String json,
      final Class<? extends Model> modelClass) {
    Response response = new Response();

    JSONParser parser = new JSONParser();
    ContainerFactory containerFactory = getContainerFactory(modelClass);

    if (json.startsWith("{")) {
      try {
        Map rootObject = (Map) parser.parse(json, containerFactory);
View Full Code Here

    return response;
  }

  private static ContainerFactory getContainerFactory(
      final Class<? extends Model> modelClass) {
    ContainerFactory containerFactory = new ContainerFactory() {
      public List creatArrayContainer() {
        return new JSONArray();
      }

      public Map createObjectContainer() {
View Full Code Here

   * @throws ParseException Throw this exception if any
   *
   */
  public static <T extends Model> T parser(final Class<T> clazz, String jsonContent) throws ParseException {
    JSONParser parser = new JSONParser();
    ContainerFactory containerFactory = new ContainerFactory() {
      public List<T> creatArrayContainer() {
        return new LinkedList<T>();
      }

      public T createObjectContainer() {
View Full Code Here

   * @param jsonContent Json content which you need to create the Model
   * @throws ParseException Throw this exception if any
   */
  public static Map parser(String jsonContent) throws ParseException {
    JSONParser parser = new JSONParser();
    ContainerFactory containerFactory = new ContainerFactory() {
      public List creatArrayContainer() {
        return new LinkedList();
      }

      public Map createObjectContainer() {
View Full Code Here

  public JsonParser() {
   
  }

  public static ContainerFactory getContainerFactory() {
    return new ContainerFactory() {
      @SuppressWarnings("rawtypes")
      public List creatArrayContainer() {
        return new LinkedList();
      }
View Full Code Here

TOP

Related Classes of org.json.simple.parser.ContainerFactory

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.