Package com.fasterxml.jackson.databind.node

Examples of com.fasterxml.jackson.databind.node.ArrayNode


        //until we support JSON stream processing only do this when the entire response is read
        if (done) {
            String data = getDataAsString();
            try {
                ObjectNode meta = (ObjectNode) DataSiftClient.MAPPER.readTree(data);
                ArrayNode interactions = (ArrayNode) meta.get("interactions");
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
View Full Code Here


    protected void readArray() {
        //until we support JSON stream processing only do this when the entire response is read
        if (done) {
            String data = getDataAsString();
            try {
                ArrayNode interactions = (ArrayNode) DataSiftClient.MAPPER.readTree(data);
                for (JsonNode interaction : interactions) {
                    send(new Interaction(interaction));
                }
                buffer.discardReadBytes();
            } catch (IOException e) {
View Full Code Here

         MapReduce.Response response = client.execute(bmr);
               
        // The query should return one phase result which is a JSON array containing
        // all the values, 0 - 199
        assertEquals(200, response.getResultsFromAllPhases().size());
        ArrayNode result = response.getResultForPhase(2);
        assertEquals(200, result.size());
       
        assertEquals(42, result.get(42).asInt());
        assertEquals(199, result.get(199).asInt());
       
        resetAndEmptyBucket(ns);
    }
View Full Code Here

        MapReduce.Response response = future.get();
       
        // The query should return one phase result which is a JSON array containing
        // all the values, 0 - 199
        assertEquals(200, response.getResultsFromAllPhases().size());
        ArrayNode result = response.getResultForPhase(1);
        assertEquals(200, result.size());
       
        assertEquals(42, result.get(42).asInt());
        assertEquals(199, result.get(199).asInt());
              
        resetAndEmptyBucket(ns);
    }
View Full Code Here

       
        // The query should return two phase results, each a JSON array containing
        // all the values, 0 - 199
        assertEquals(400, response.getResultsFromAllPhases().size());
        assertEquals(200, response.getResultForPhase(0).size());
        ArrayNode result = response.getResultForPhase(1);
        assertEquals(200, result.size());
       
        assertEquals(42, result.get(42).asInt());
        assertEquals(199, result.get(199).asInt());
       
        resetAndEmptyBucket(ns);
    }
View Full Code Here

    private List<FoursquareUserFriendGroup> groups = new ArrayList<FoursquareUserFriendGroup>();

    @Override
    protected void buildFromJson(JsonNode json) {
        count = json.get("count").asInt();
        ArrayNode groupsArray = (ArrayNode) json.get("groups");

        for (int i=0;i<groupsArray.size();i++) {
            FoursquareUserFriendGroup group = new FoursquareUserFriendGroup();
            group.buildFromJson(groupsArray.get(i));
            groups.add(group);
        }
    }
View Full Code Here

    protected void buildFromJson(JsonNode json) {
        count = json.get("count").asInt();
        name = json.get("name").asText();
        type = json.get("type").asText();

        ArrayNode groupsArray = (ArrayNode) json.get("items");

        for (int i=0;i<groupsArray.size();i++) {
            FoursquareUserFriend friend = new FoursquareUserFriend();
            friend.buildFromJson(groupsArray.get(i));
            friends.add(friend);
        }
    }
View Full Code Here

  @Override
  protected VkProfile extractUserProfile(final String body) {
    final VkProfile profile = new VkProfile();
    JsonNode json = JsonHelper.getFirstNode(body);
    if (json != null) {
      ArrayNode array = (ArrayNode) json.get("response");
      JsonNode userNode = array.get(0);
      profile.setId(JsonHelper.get(userNode, "uid"));
      for (final String attribute : OAuthAttributesDefinitions.vkDefinition.getAllAttributes()) {
        profile.addAttribute(attribute, JsonHelper.get(userNode, attribute));
      }
    }
View Full Code Here

    JsonNode node = new ObjectMapper().readTree(json);

    ObjectNode objElem = (ObjectNode) valueReader.get(node, "object");
    assertEquals(objElem.get("subkey").asText(), "subvalue");

    ArrayNode arrayElem = (ArrayNode) valueReader.get(node, "array");
    assertEquals(Arrays.asList(arrayElem.get(0).asText(), arrayElem.get(1).asText()),
        Arrays.asList("elem1", "elem2"));

    assertEquals(valueReader.get(node, "boolean"), true);
    assertEquals(((Number) valueReader.get(node, "number")).intValue(), 55);
    assertEquals(valueReader.get(node, "string"), "foo");
View Full Code Here

  @Override
  public Map<CurrencyPair, CryptoTradePair> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

    final ObjectCodec oc = jp.getCodec();
    final JsonNode rootNode = oc.readTree(jp);
    final ArrayNode currencyPairs = (ArrayNode) rootNode.path("currency_pairs");
    final ArrayNode securityPairs = (ArrayNode) rootNode.path("security_pairs");

    final Map<CurrencyPair, CryptoTradePair> pairs = new HashMap<CurrencyPair, CryptoTradePair>();
    for (JsonNode pairInfo : currencyPairs) {
      final CryptoTradePairType type = CryptoTradePairType.normal_pair;
      String label = pairInfo.fieldNames().next();
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.node.ArrayNode

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.