Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JavaType


    }

   
    protected JavaType _fromArrayType(GenericArrayType type, TypeBindings context)
    {
        JavaType compType = _constructType(type.getGenericComponentType(), context);
        return ArrayType.construct(compType, null, null);
    }
View Full Code Here


            return _unknownType();
        }

        // Ok: here's where context might come in handy!
        String name = type.getName();
        JavaType actualType = context.findType(name);
        if (actualType != null) {
            return actualType;
        }

        /* 29-Jan-2010, tatu: We used to throw exception here, if type was
View Full Code Here

                        ListResponse.MinimalItemListResponse.class));
        /* "full" ListItemType is trickier, since we need to use generic type definition
         * to parameterize appropriate Full
         */
        // Ugh. Jackson's type resolution fails if using "FullItemListResponse"... need to work around it
        JavaType fullResponseType = config.getJsonMapper().getTypeFactory().constructParametricType(
                ListResponse.class, listItemType);
        _listReaders.put(ListItemType.fullEntries,
                new GenericContentConverter<ListResponse<ListItem>>(mapper, fullResponseType));
    }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = AccountInfoJSONTest.class.getResourceAsStream("/account/account.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosAccount.class);
    VosResponse<VosAccount> vosAccount = mapper.readValue(is, type);

    // Verify that the example data was unmarshalled correctly
    assertThat(vosAccount.getData().getWallets().getVosMap().get("BTC").getBalance().getValue()).isEqualTo(new BigDecimal("0.61305182"));
    assertThat(vosAccount.getData().getTrade_fee().getVosMap().get("DOGE").getValue()).isEqualTo(new BigDecimal("0.00400"));
    assertThat(vosAccount.getData().getRights()[0]).isEqualTo("getinfo");

    // Read in the JSON from the example resources
    is = AccountInfoJSONTest.class.getResourceAsStream("/account/balance_btc.json");

    // Use Jackson to parse it
    JavaType type2 = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosCurrency.class);
    VosResponse<VosCurrency> vosBalance = mapper.readValue(is, type2);

    // Verify that the example data was unmarshalled correctly
    assertThat(vosBalance.getData().getValue()).isEqualTo(new BigDecimal("0.61305182"));
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiDepthJSONTest.class.getResourceAsStream("/marketdata/example-depth-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosDepth.class);
    VosResponse<VosDepth> vaultOfSatoshiDepth = mapper.readValue(is, type);

    // Verify that the example data was unmarshalled correctly
    assertThat(vaultOfSatoshiDepth.getData().getAsks().get(0).getAmount().getValue()).isEqualTo(new BigDecimal("0.22000000"));
  }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosTicker.class);
    VosResponse<VosTicker> VaultOfSatoshiTicker = mapper.readValue(is, type);

    // Verify that the example data was unmarshalled correctly
    assertThat(VaultOfSatoshiTicker.getData().getLast()).isEqualTo(new BigDecimal("684.00000000"));
    assertThat(VaultOfSatoshiTicker.getData().getHigh()).isEqualTo(new BigDecimal("686.50000000"));
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiTradesJSONTest.class.getResourceAsStream("/marketdata/example-trades-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(List.class, VosTrade.class);
    JavaType type2 = mapper.getTypeFactory().constructParametricType(VosResponse.class, type);
    VosResponse<List<VosTrade>> vosTrades = mapper.readValue(is, type2);

    // Verify that the example data was unmarshalled correctly
    assertThat(vosTrades.getData().get(0).getPrice().getValue()).isEqualTo(new BigDecimal("641.18165850"));
  }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiDepthJSONTest.class.getResourceAsStream("/marketdata/example-depth-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosDepth.class);
    VosResponse<VosDepth> VaultOfSatoshiDepth = mapper.readValue(is, type);

    List<LimitOrder> asks = VaultOfSatoshiAdapters.adaptOrders(VaultOfSatoshiDepth.getData().getAsks(), new CurrencyPair("BTC", "USD"), "ask", "");

    // Verify all fields filled
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiTradesJSONTest.class.getResourceAsStream("/marketdata/example-trades-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosTrade[].class);
    VosResponse<VosTrade[]> vosTrades = mapper.readValue(is, type);

    Trades trades = VaultOfSatoshiAdapters.adaptTrades(vosTrades.getData(), CurrencyPair.BTC_USD);
    assertThat(trades.getTrades().size()).isEqualTo(2);
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = VaultOfSatoshiTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosTicker.class);
    VosResponse<VosTicker> VaultOfSatoshiTicker = mapper.readValue(is, type);

    Ticker ticker = VaultOfSatoshiAdapters.adaptTicker(VaultOfSatoshiTicker.getData(), CurrencyPair.BTC_USD);
    System.out.println(ticker.toString());
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.JavaType

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.