Package com.fasterxml.jackson.core

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


        @Override
        public UnregisterMessageImpl deserialize(final JsonParser jp, final DeserializationContext ctxt)
                throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            final JsonNode channelIdNode = node.get(RegisterMessage.CHANNEL_ID_FIELD);
            return new UnregisterMessageImpl(channelIdNode.asText());
        }
    }
View Full Code Here


    private static class MessageTypeDeserializer extends JsonDeserializer<MessageType> {

        @Override
        public MessageType deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            final JsonNode messageTypeNode = node.get(MessageType.MESSSAGE_TYPE_FIELD);
            return new MessageType() {
                @Override
                public Type getMessageType() {
                    if (messageTypeNode == null) {
View Full Code Here

        @Override
        public UnregisterResponseImpl deserialize(final JsonParser jp, final DeserializationContext ctxt)
                throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            final JsonNode channelIdNode = node.get(RegisterResponse.CHANNEL_ID_FIELD);
            return new UnregisterResponseImpl(channelIdNode.asText(), new StatusImpl(node.get(UnregisterResponse.STATUS_FIELD).asInt(), "N/A"));
        }
    }
View Full Code Here

    private static class PingDeserializer extends JsonDeserializer<PingMessageImpl> {

        @Override
        public PingMessageImpl deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            if (node.isObject() && node.size() == 0) {
                return new PingMessageImpl(node.toString());
            }
            throw new RuntimeException("Invalid Ping message format : [" + node.toString() + "]");
        }
View Full Code Here

        @Override
        public RegisterMessageImpl deserialize(final JsonParser jp, final DeserializationContext ctxt)
                throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            return new RegisterMessageImpl(node.get(RegisterMessage.CHANNEL_ID_FIELD).asText());
        }
    }

    private static class RegisterSerializer extends JsonSerializer<RegisterMessage> {
View Full Code Here

        @Override
        public RegisterResponseImpl deserialize(final JsonParser jp, final DeserializationContext ctxt)
                throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            return new RegisterResponseImpl(node.get(RegisterMessage.CHANNEL_ID_FIELD).asText(),
                    new StatusImpl(node.get(RegisterResponseImpl.STATUS_FIELD).asInt(), "N/A"),
                    node.get(RegisterResponseImpl.PUSH_ENDPOINT__FIELD).asText());
        }
    }
View Full Code Here

  public class ObjectIdJsonDeserializer extends JsonDeserializer<ObjectId> {
    @Override
    public ObjectId deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
      ObjectCodec oc = jp.getCodec();
      JsonNode node = oc.readTree(jp);
      if(node.isNull() || !node.has("$oid") || node.get("$oid").isNull()) {
        return null;
      }
      return new ObjectId(node.get("$oid").textValue());
    }
View Full Code Here

    @Override
    public EventDetails deserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
        ObjectCodec oc = jp.getCodec();
        JsonNode node = oc.readTree(jp);
        return getDetails(node);
    }

    private static EventDetails getDetails(final JsonNode node)
    {
View Full Code Here

  @Override
  public JobParameter deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
      throws IOException,
      JsonProcessingException {
    ObjectCodec oc = jsonParser.getCodec();
    JsonNode node = oc.readTree(jsonParser);

    final String value = node.get("value").asText();
    final boolean identifying = node.get("identifying").asBoolean();
    final String type = node.get("type").asText();
View Full Code Here

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

    ObjectCodec oc = jp.getCodec();
    JsonNode root = oc.readTree(jp);
    return parseGeometry(root);
  }

  public Geometry parseGeometry(JsonNode root) {
    String typeName = root.get("type").asText();
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.