Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.ObjectCodec.readTree()


    @Override
    public Link deserialize(JsonParser jsonParser,
                            DeserializationContext deserializationContext) throws IOException, JsonProcessingException {

        ObjectCodec oc = jsonParser.getCodec();
        JsonNode node = oc.readTree(jsonParser);
        String rel = node.fieldNames().next();
        String href = node.elements().next().get("href").textValue();


        return new Link(rel,href);
View Full Code Here


    @Override
    public Map<String, Object> deserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
        ObjectCodec oc = jp.getCodec();
        JsonNode node = oc.readTree(jp);
        Map<String, Object> metadata = unmarshal(node.fields(), new HashMap<String, Object>());
        Map<String, Object> json = new HashMap<>();
        json.put("metadata", metadata);
        return json;
    }
View Full Code Here

      throws IOException {

  Money result = null;

  ObjectCodec oc = jsonParser.getCodec();
  JsonNode node = oc.readTree(jsonParser);

  String currency = null;
  String amount = null;
  Long cents = null;
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) {
View Full Code Here

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

    final ObjectCodec oc = jp.getCodec();
    final JsonNode statusNode = oc.readTree(jp);
    final JsonNode pairDataNode = statusNode.path("data");

    return getPairFromJsonNode(pairDataNode, statusNode);
  }
View Full Code Here

    @Override
    public CexIOOpenOrders deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      final ObjectCodec oc = jp.getCodec();
      final JsonNode openOrdersNode = oc.readTree(jp);

      final JsonNode errorNode = openOrdersNode.path("error");
      if (!errorNode.isMissingNode()) {
        final String errorText = errorNode.asText();
        if (errorText.equals("Invalid symbols pair")) {
View Full Code Here

    @Override
    public CryptoTradePublicOrder deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      final ObjectCodec oc = jp.getCodec();
      final JsonNode node = oc.readTree(jp);
      final String priceString = node.path(0).asText();
      final String amountString = node.path(1).asText();

      return new CryptoTradePublicOrder(new BigDecimal(amountString), new BigDecimal(priceString));
    }
View Full Code Here

    @Override
    public LedgerType deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      String ledgerTypeString = node.textValue();
      return fromString(ledgerTypeString);
    }

  }
View Full Code Here

    public KrakenPublicTrades deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      List<KrakenPublicTrade> krakenTrades = new ArrayList<KrakenPublicTrade>();
      long last = 0;
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      Iterator<Entry<String, JsonNode>> tradesResultIterator = node.fields();
      while (tradesResultIterator.hasNext()) {
        Entry<String, JsonNode> entry = tradesResultIterator.next();
        String key = entry.getKey();
        JsonNode value = entry.getValue();
View Full Code Here

    public KrakenSpreads deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException {

      List<KrakenSpread> krakenTrades = new ArrayList<KrakenSpread>();
      long last = 0;
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      Iterator<Entry<String, JsonNode>> tradesResultIterator = node.fields();
      while (tradesResultIterator.hasNext()) {
        Entry<String, JsonNode> entry = tradesResultIterator.next();
        String key = entry.getKey();
        JsonNode value = entry.getValue();
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.