Package com.fasterxml.jackson.databind.module

Examples of com.fasterxml.jackson.databind.module.SimpleModule.addDeserializer()


        module.addDeserializer(NotificationMessageImpl.class, new NotificationDeserializer());
        module.addSerializer(NotificationMessageImpl.class, new NotificationSerializer());

        module.addDeserializer(UnregisterMessageImpl.class, new UnregisterDeserializer());
        module.addSerializer(UnregisterMessageImpl.class, new UnregisterMessageSerializer());
        module.addDeserializer(UnregisterResponseImpl.class, new UnregisterResponseDeserializer());
        module.addSerializer(UnregisterResponseImpl.class, new UnregisterResponseSerializer());

        om.registerModule(module);
        return om;
    }
View Full Code Here


        init(objectMapper);
    }

    protected void init(ObjectMapper objectMapper) {
        SimpleModule module = new SimpleModule();
        module.addDeserializer(Event.class, eventDeserializer);
        module.addDeserializer(JsonObject.class, jsonObjectDeserializer);
        module.addDeserializer(AckArgs.class, ackArgsDeserializer);
        objectMapper.registerModule(module);

        objectMapper.setSerializationInclusion(Include.NON_NULL);
View Full Code Here

    }

    protected void init(ObjectMapper objectMapper) {
        SimpleModule module = new SimpleModule();
        module.addDeserializer(Event.class, eventDeserializer);
        module.addDeserializer(JsonObject.class, jsonObjectDeserializer);
        module.addDeserializer(AckArgs.class, ackArgsDeserializer);
        objectMapper.registerModule(module);

        objectMapper.setSerializationInclusion(Include.NON_NULL);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
View Full Code Here

    protected void init(ObjectMapper objectMapper) {
        SimpleModule module = new SimpleModule();
        module.addDeserializer(Event.class, eventDeserializer);
        module.addDeserializer(JsonObject.class, jsonObjectDeserializer);
        module.addDeserializer(AckArgs.class, ackArgsDeserializer);
        objectMapper.registerModule(module);

        objectMapper.setSerializationInclusion(Include.NON_NULL);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        objectMapper.configure(SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN, true);
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    SimpleModule module = new SimpleModule();
    module.addSerializer(ObjectId.class, new ObjectIdJsonSerializer());
    module.addDeserializer(ObjectId.class, new ObjectIdJsonDeserializer());
    mapper.registerModule(module);
    return mapper;
  }

  public class ObjectIdJsonSerializer extends JsonSerializer<ObjectId> {
View Full Code Here

        }
        if (customDeserializers != null) {
            final StringTokenizer st = new StringTokenizer(customDeserializers, ", ");
            while (st.hasMoreTokens()) {
                final Class<?> aClass = classLoader.loadClass(st.nextToken());
                simpleModule.addDeserializer(aClass, (JsonDeserializer) aClass.newInstance());
            }
        }
        objectMapper.registerModule(simpleModule);
    }
View Full Code Here

        }
        if (customDeserializers != null) {
            final StringTokenizer st = new StringTokenizer(customDeserializers, ", ");
            while (st.hasMoreTokens()) {
                final Class<?> aClass = classLoader.loadClass(st.nextToken());
                simpleModule.addDeserializer(aClass, (JsonDeserializer) aClass.newInstance());
            }
        }
        objectMapper.registerModule(simpleModule);
    }
View Full Code Here

        // Since JSON will be coming from candlepin and the objects may have different schemas,
        // don't fail on unknown properties.
        configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        SimpleModule module = new SimpleModule();
        module.addDeserializer(Entitlement.class, new EntitlementDeserializer());
        this.registerModule(module);
    }
}
View Full Code Here

    JsonMapper newMapper = JsonMapper.nonEmptyMapper();

    SimpleModule moneyModule = new SimpleModule("MoneyModule");
    moneyModule.addSerializer(new MoneySerializer());
    moneyModule.addDeserializer(Money.class, new MoneyDeserializer());
    newMapper.getMapper().registerModule(moneyModule);

    // tojson
    User user = new User();
    user.setName("foo");
View Full Code Here

        } else {
            try {
                NodeStats.UndefinedStatDeserializer usd = new NodeStats.UndefinedStatDeserializer();
                SimpleModule module = new SimpleModule("UndefinedStatDeserializer",
                                                       new Version(1,0,0,null,null,null));
                module.addDeserializer(BigInteger.class, usd);
                return new ObjectMapper().registerModule(module).readValue(r.getBodyAsString(), NodeStats.class);
            } catch (IOException e) {
                throw new IOException("Could not parse stats JSON response, body: " + r.getBodyAsString(),e);
            }
        }
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.