Package com.fasterxml.jackson.databind.module

Examples of com.fasterxml.jackson.databind.module.SimpleModule


  @Override
  public List<? extends Module> getJacksonModules()
  {
    return Arrays.<Module>asList(
        new SimpleModule("FirehoseModule")
            .registerSubtypes(
                new NamedType(ClippedFirehoseFactory.class, "clipped"),
                new NamedType(TimedShutoffFirehoseFactory.class, "timed"),
                new NamedType(IrcFirehoseFactory.class, "irc"),
                new NamedType(LocalFirehoseFactory.class, "local"),
View Full Code Here


  @Override
  public List<? extends com.fasterxml.jackson.databind.Module> getJacksonModules()
  {
    return Arrays.asList(
        new SimpleModule()
            .registerSubtypes(
                new NamedType(SingleDimensionShardSpec.class, "single"),
                new NamedType(LinearShardSpec.class, "linear"),
                new NamedType(NumberedShardSpec.class, "numbered"),
                new NamedType(HashBasedNumberedShardSpec.class, "hashed")
View Full Code Here

{
  @Override
  public List<? extends Module> getJacksonModules()
  {
    return ImmutableList.of(
        new SimpleModule("RabbitMQFirehoseModule")
            .registerSubtypes(
                new NamedType(RabbitMQFirehoseFactory.class, "rabbitmq")
            )
    );
  }
View Full Code Here

{
  @Override
  public List<? extends Module> getJacksonModules()
  {
    return ImmutableList.of(
        new SimpleModule().registerSubtypes(new NamedType(StaticS3FirehoseFactory.class, "static-s3"))
    );
  }
View Full Code Here

        public String value1;
        public String value2;
    }

    private ObjectMapper createObjectMapper() {
        SimpleModule module = new SimpleModule("MySimpleModule", new Version(1,
                0, 0, null, "", ""));
        module.addDeserializer(Custom.class, new JsonDeserializer<Custom>() {
            @Override
            public Custom deserialize(JsonParser jp, DeserializationContext ctxt)
                    throws IOException {
                JsonNode node = jp.readValueAsTree();
                return new Custom(node.get("v1").asText(), node.get("v2")
                        .asText());
            }
        });
        module.addSerializer(Custom.class, new JsonSerializer<Custom>() {
            @Override
            public void serialize(Custom value, JsonGenerator jgen,
                    SerializerProvider provider) throws IOException {
                jgen.writeStartObject();
                jgen.writeFieldName("v1");
View Full Code Here

            throw new IOException("stats failed with status code: "
                + r.getStatusCode());
        } 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

        this.configuration = configuration;
        init(objectMapper);
    }

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

        objectMapper.setSerializationInclusion(Include.NON_NULL);

//        TODO If jsonObjectDeserializer will be not enough
View Full Code Here

public class DebugObjectMapper extends ObjectMapper {

   private SimpleModule myModule;

   public DebugObjectMapper() {
      myModule = new SimpleModule();
      myModule.addSerializer(new ByteArraySerializer());
      registerModule(myModule);
      configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
   }
View Full Code Here

    mappingContext.getPersistentEntity(Sample.class);
    mappingContext.getPersistentEntity(SampleWithAdditionalGetters.class);

    PersistentEntities persistentEntities = new PersistentEntities(Arrays.asList(mappingContext));

    SimpleModule module = new SimpleModule();
    module.setSerializerModifier(new PersistentEntityJackson2Module.AssociationOmittingSerializerModifier(
        persistentEntities, associationLinks, new RepositoryRestConfiguration()));

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

    if (this.serializationInclusion != null) {
      objectMapper.setSerializationInclusion(this.serializationInclusion);
    }

    if (!this.serializers.isEmpty() || !this.deserializers.isEmpty()) {
      SimpleModule module = new SimpleModule();
      addSerializers(module);
      addDeserializers(module);
      objectMapper.registerModule(module);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.module.SimpleModule

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.