Examples of JsonParser


Examples of com.facebook.presto.jdbc.internal.jackson.core.JsonParser

    {
        // First: add closing END_OBJECT as marker
        unknownTokens.writeEndObject();
       
        // note: buffer does NOT have starting START_OBJECT
        JsonParser bufferParser = unknownTokens.asParser();
        while (bufferParser.nextToken() != JsonToken.END_OBJECT) {
            String propName = bufferParser.getCurrentName();
            // Unknown: let's call handler method
            bufferParser.nextToken();
            handleUnknownProperty(bufferParser, ctxt, bean, propName);
        }
        return bean;
    }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonParser

     */
    public AbsoluteRange getHistogramBoundaries() {
        if (boundaries == null) {
            try {
                ObjectMapper mapper = new ObjectMapper();
                JsonParser jp = mapper.getFactory().createParser(getBuiltQuery());
                JsonNode rootNode = mapper.readTree(jp);
                JsonNode timestampNode = rootNode.findValue("range").findValue("timestamp");
                String from = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("from").asText());
                String to = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("to").asText());
                boundaries = new AbsoluteRange(from, to);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonParser

      JsonMappingException {
    // Read mapping out of JSON file
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory factory = new JsonFactory();
    InputStream is = this.getClass().getResourceAsStream(MAPPING_FILE);
    JsonParser jp = factory.createParser(is);

    jp.nextToken();
    mappings.clear();
    while (jp.nextToken() == JsonToken.START_OBJECT) {
      URLMapping mapping = mapper.readValue(jp, URLMapping.class);
      mappings.add(mapping);
    }
  }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonParser

   * @return the decoded structure.
   */
  @Override
  public final CouchbaseStorable decode(final Object source, final CouchbaseStorable target) {
    try {
      JsonParser parser = factory.createParser((String) source);
      while (parser.nextToken() != null) {
        JsonToken currentToken = parser.getCurrentToken();

        if (currentToken == JsonToken.START_OBJECT) {
          return decodeObject(parser, (CouchbaseDocument) target);
        } else if (currentToken == JsonToken.START_ARRAY) {
          return decodeArray(parser, new CouchbaseList());
        } else {
          throw new MappingException("JSON to decode needs to start as array or object!");
        }
      }
      parser.close();
    } catch (IOException ex) {
      throw new RuntimeException("Could not decode JSON", ex);
    }
    return target;
  }
View Full Code Here

Examples of com.github.jsonj.tools.JsonParser

            int length = in.readInt();
            byte[] buf = new byte[length];
            in.readFully(buf);
            if (parser == null) {
                // create it lazily, static so won't increase object size
                parser = new JsonParser();
            }
            JsonElement o = parser.parse(new String(buf, UTF8));
            Field f = getClass().getDeclaredField("intMap");
            f.setAccessible(true);
            f.set(this, new SimpleIntKeyMap<>());
View Full Code Here

Examples of com.google.api.client.json.JsonParser

   */
  public static JsonParser parserForResponse(JsonFactory jsonFactory, HttpResponse response)
      throws IOException {
    InputStream content = response.getContent();
    try {
      JsonParser parser = jsonFactory.createJsonParser(content);
      parser.nextToken();
      content = null;
      return parser;
    } finally {
      if (content != null) {
        content.close();
View Full Code Here

Examples of com.google.gson.JsonParser

      }

      JsonObject ipObject = new JsonObject();

      if (input.getMeta() != null) {
         ipObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      return ipObject;
   }
View Full Code Here

Examples of com.google.gson.JsonParser

      }

      JsonObject vlanObject = new JsonObject();

      if (input.getMeta() != null) {
         vlanObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      return vlanObject;
   }
View Full Code Here

Examples of com.google.gson.JsonParser

      if (input.getMedia() != null) {
         driveObject.addProperty("media", input.getMedia().toString());
      }

      if (input.getAffinities() != null) {
         driveObject.add("affinities", new JsonParser().parse(new Gson().toJson(input.getAffinities())));
      }

      if (input.getMeta() != null) {
         driveObject.add("meta", new JsonParser().parse(new Gson().toJson(input.getMeta())));
      }

      if (input.getTags() != null) {
         driveObject.add("tags", new JsonParser().parse(new Gson().toJson(input.getTags())));
      }

      driveObject.addProperty("allow_multimount", input.isAllowMultimount());
      return driveObject;
   }
View Full Code Here

Examples of com.google.gson.JsonParser

public final class JsonToResource {
  private JsonToResource() {
  }

  public static Resource parse(InputStream inputStream) {
    JsonElement element = new JsonParser().parse(new InputStreamReader(inputStream));
    return parseResource(element.getAsJsonObject(), "/", null);
  }
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.