Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper


    @SuppressWarnings("unchecked")
    public List<DBObject> createIndex() throws Exception {
        List<DBObject> indexList = new ArrayList<DBObject>();

        if (ObjectHelper.isNotEmpty(collectionIndex)) {
            HashMap<String, String> indexMap = new ObjectMapper().readValue(collectionIndex, HashMap.class);

            for (Map.Entry<String, String> set : indexMap.entrySet()) {
                DBObject index = new BasicDBObject();
                // MongoDB 2.4 upwards is restrictive about the type of the 'single field index' being
                // in use below (set.getValue())) as only an integer value type is accepted, otherwise
View Full Code Here


    @SuppressWarnings("unchecked")
    public List<DBObject> createIndex() throws Exception {
        List<DBObject> indexList = new ArrayList<DBObject>();

        if (ObjectHelper.isNotEmpty(collectionIndex)) {
            HashMap<String, String> indexMap = new ObjectMapper().readValue(collectionIndex, HashMap.class);

            for (Map.Entry<String, String> set : indexMap.entrySet()) {
                DBObject index = new BasicDBObject();
                // MongoDB 2.4 upwards is restrictive about the type of the 'single field index' being
                // in use below (set.getValue())) as only an integer value type is accepted, otherwise
View Full Code Here


    @Test
    public void testPolymorphicJacksonSerializationAndDeserialization()
    {
        ObjectMapper mapper = new ObjectMapper();

        SimpleModule testModule = new SimpleModule("testModule", new Version(1, 0, 0, null, null, null))
                .addDeserializer( QueryFilter.class, new QueryFilterDeserializer() )
                .addSerializer( LogicalFilter2.class, new LogicalFilter2Serializer() );

        mapper.registerModule(testModule);

        // Verifying that we can pass in a custom Mapper and create a new JsonUtil
        JsonUtil jsonUtil = JsonUtils.customJsonUtil( mapper );

        String testFixture = "/jsonUtils/testdomain/two/queryFilter-realAndLogical2.json";
View Full Code Here

    super();

    SimpleModule gimpleModule = new SimpleModule("Gimple", Version.unknownVersion()).addDeserializer(GimpleOp.class,
        new GimpleOpDeserializer());

    mapper = new ObjectMapper();
    mapper.registerModule(gimpleModule);
  }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = BTCETradeHistoryJSONTest.class.getResourceAsStream("/v2/trade/example-trade-history-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    BTCETradeHistoryReturn transactions = mapper.readValue(is, BTCETradeHistoryReturn.class);
    Map<Long, BTCETradeHistoryResult> result = transactions.getReturnValue();
    assertThat(result.size()).isEqualTo(32);
    Entry<Long, BTCETradeHistoryResult> firstEntry = result.entrySet().iterator().next();
    // Verify that the example data was unmarshalled correctly
    assertThat(firstEntry.getKey()).isEqualTo(7258275L);
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = BTCETradeDataJSONTest.class.getResourceAsStream(file);

    // Use Jackson to parse it
    return new ObjectMapper().readValue(is, resultClass);
  }
View Full Code Here

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

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    LakeBTCTickers tickers = mapper.readValue(is, LakeBTCTickers.class);

    LakeBTCTicker cnyTicker = tickers.getCny();
    Ticker adaptedTicker = LakeBTCAdapters.adaptTicker(cnyTicker, CurrencyPair.BTC_CNY);

    assertThat(adaptedTicker.getAsk()).isEqualTo("3524.07");
View Full Code Here

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

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    LakeBTCOrderBook orderBook = mapper.readValue(is, LakeBTCOrderBook.class);

    OrderBook adaptedOrderBook = LakeBTCAdapters.adaptOrderBook(orderBook, CurrencyPair.BTC_USD);

    List<LimitOrder> asks = adaptedOrderBook.getAsks();
    assertThat(asks.size()).isEqualTo(3);
View Full Code Here

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

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    LakeBTCTickers tickers = mapper.readValue(is, LakeBTCTickers.class);

    LakeBTCTicker cnyTicker = tickers.getCny();
    assertThat(cnyTicker.getAsk()).isEqualTo("3524.07");
    assertThat(cnyTicker.getBid()).isEqualTo("3517.13");
    assertThat(cnyTicker.getLast()).isEqualTo("3524.07");
View Full Code Here

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

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    LakeBTCOrderBook orderBook = mapper.readValue(is, LakeBTCOrderBook.class);

    BigDecimal[][] asks = orderBook.getAsks();
    assertThat(asks).hasSize(3);
    assertThat(asks[0][0]).isEqualTo("564.87");
    assertThat(asks[0][1]).isEqualTo("22.371");
View Full Code Here

TOP

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

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.