Examples of registerModule()


Examples of com.fasterxml.jackson.databind.ObjectMapper.registerModule()

    {
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule mod = new SimpleModule("test", Version.unknownVersion());
        // default is HashMap, so:
        mod.addAbstractTypeMapping(Map.class, TreeMap.class);
        mapper.registerModule(mod);
        Map<?,?> result = mapper.readValue("{}", Map.class);
        assertEquals(TreeMap.class, result.getClass());
    }
   
    public void testInterfaceDefaulting() throws Exception
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.registerModule()

    {
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule mod = new SimpleModule("test", Version.unknownVersion());
        // let's ensure we get hierarchic mapping
        mod.addAbstractTypeMapping(CharSequence.class, MyString.class);
        mapper.registerModule(mod);
        Object result = mapper.readValue(quote("abc"), CharSequence.class);
        assertEquals(MyString.class, result.getClass());
        assertEquals("abc", ((MyString) result).value);
    }
}
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.registerModule()

//            new org.codehaus.jackson.smile.SmileFactory();
        ;
//        ((SmileFactory) jsonF).configure(SmileGenerator.Feature.CHECK_SHARED_NAMES, false);
           
        final ObjectMapper jsonMapper = new ObjectMapper(jsonF);
        jsonMapper.registerModule(new AfterburnerModule());

//      jsonMapper.configure(SerializationConfig.Feature.USE_STATIC_TYPING, true);

        /*
        final SmileFactory smileFactory = new SmileFactory();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.registerModule()

        SimpleModule module = new SimpleModule();
        module.addDeserializer(Money.class, new MoneyDeserializer());
        module.addDeserializer(CurrencyUnit.class, new CurrencyUnitDeserializer());
        module.addSerializer(CurrencyUnit.class, new CurrencyUnitSerializer());
        result.registerModule(module);

        result.registerModule(new JodaModule());

        return result;
    }
View Full Code Here

Examples of com.fasterxml.jackson.dataformat.xml.XmlMapper.registerModule()

        // the Json output. You can change that with annotations in your
        // models.
        module.setDefaultUseWrapper(false);
       
        XmlMapper xmlMapper = new XmlMapper(module);
        xmlMapper.registerModule(new AfterburnerModule());

       
        return xmlMapper;
       
    }
View Full Code Here

Examples of com.graphaware.runtime.GraphAwareRuntime.registerModule()

    @Before
    public void setUp() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        GraphAwareRuntime runtime = GraphAwareRuntimeFactory.createRuntime(database);
        runtime.registerModule(new FriendshipStrengthModule("FSM", database));
        runtime.start();
    }

    @After
    public void tearDown() {
View Full Code Here

Examples of com.library.bookmanangement_library.CustomJson.registerModule()

  @Override
  public Json getJson() {
    final CustomJson json = new CustomJson();
        for (Module module : getJacksonModules()) {
            json.registerModule(module);
        }
        return json;
  }

}
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.registerModule()

    mapper.getSerializationConfig().addMixInAnnotations(JobModel.class, JsonJobModelMixIn.class);
    mapper.getDeserializationConfig().addMixInAnnotations(JobModel.class, JsonJobModelMixIn.class);

    // Convert camel case to hyphenated field names, and register the module.
    mapper.setPropertyNamingStrategy(new CamelCaseToDashesStrategy());
    mapper.registerModule(module);

    return mapper;
  }

  public static class ConfigDeserializer extends JsonDeserializer<Config> {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.registerModule()

  public static String toJson(Object object) {
    ObjectMapper mapper = new ObjectMapper(new MyJsonFactory());
    SimpleModule module = new SimpleModule("fullcalendar", new Version(1, 0, 0, null));
    module.addSerializer(new DateTimeSerializer());
    module.addSerializer(new LocalTimeSerializer());
    mapper.registerModule(module);
    mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);

    String json = null;
    try {
      json = mapper.writeValueAsString(object);
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.registerModule()

    module.addSerializer(Stems.class, injector.getInstance(StemsSerializer.class));
    module.addSerializer(Area.class, injector.getInstance(AreaSerializer.class));
    module.addSerializer(YAxis.class, injector.getInstance(YAxisSerializer.class));
    module.addSerializer(Crosshair.class, injector.getInstance(CrosshairSerializer.class));

    mapper.registerModule(module);

    SerializationConfig config = mapper.getSerializationConfig();

    // Pretty
    mapper.enable(SerializationConfig.Feature.INDENT_OUTPUT);
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.