Examples of SimpleModule


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

        mapper.disable(MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS)
            .disable(MapperFeature.AUTO_DETECT_FIELDS)
            .disable(MapperFeature.AUTO_DETECT_GETTERS)
            .disable(MapperFeature.AUTO_DETECT_IS_GETTERS)
            .disable(MapperFeature.INFER_PROPERTY_MUTATORS);
        SimpleModule module = new SimpleModule("Test");
        module.setMixInAnnotation(Person.class, PersonMixin.class);       
        mapper.registerModule(module);

        assertEquals("{\"city\":\"Seattle\"}", mapper.writeValueAsString(new PersonImpl()));
    }
View Full Code Here

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

    // [Issue#227]
    public void testGenericEnumSerializer() throws Exception
    {
        // By default, serialize using name
        ObjectMapper m = new ObjectMapper();
        SimpleModule module = new SimpleModule("foobar");
        module.addSerializer(Enum.class, new LowerCasingEnumSerializer());
        m.registerModule(module);
        assertEquals(quote("b"), m.writeValueAsString(TestEnum.B));
    }
View Full Code Here

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

    {
        ObjectMapper mapper = new ObjectMapper();

        mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, "@class");

         SimpleModule testModule = new SimpleModule("MyModule", new Version(1, 0, 0, null, "TEST", "TEST"));
         testModule.addDeserializer(SavedCookie.class, new SavedCookieDeserializer());
         mapper.registerModule(testModule);

         SavedCookie savedCookie = new SavedCookie("key", "v");
         String json = mapper.writeValueAsString(savedCookie);
         SavedCookie out = mapper.reader(SavedCookie.class).readValue(json);
View Full Code Here

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

     */

    public void testCustomDeserializers() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule testModule = new SimpleModule("test", Version.unknownVersion());
        testModule.addDeserializer(NonDeserializable[].class, new CustomNonDeserArrayDeserializer());
        mapper.registerModule(testModule);
       
        NonDeserializable[] result = mapper.readValue("[\"a\"]", NonDeserializable[].class);
        assertNotNull(result);
        assertEquals(1, result.length);
View Full Code Here

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

    // for [JACKSON-670]
    public void testEmptyBean() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new SimpleModule("test", Version.unknownVersion()) {
            @Override
            public void setupModule(SetupContext context)
            {
                super.setupModule(context);
                context.addBeanSerializerModifier(new EmptyBeanModifier());
View Full Code Here

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

    // [Issue#539]
    public void testEmptyBean539() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new SimpleModule("test", Version.unknownVersion()) {
            @Override
            public void setupModule(SetupContext context)
            {
                super.setupModule(context);
                context.addBeanSerializerModifier(new EmptyBeanModifier539());
View Full Code Here

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

    // [Issue#121]

    public void testModifyArraySerializer() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new SimpleModule("test")
            .setSerializerModifier(new ArraySerializerModifier()));
        assertEquals("123", mapper.writeValueAsString(new Integer[] { 1, 2 }));
    }
View Full Code Here

Examples of hivemind.test.services.SimpleModule

*/
public class TestRegistryImpl extends HiveMindTestCase
{
    public void testGetModuleMessages() throws Exception
    {
        final Registry reg = buildFrameworkRegistry(new SimpleModule());
        final Messages msgs = reg.getModuleMessages( "hivemind.test.services" );
        assertEquals( "Test Message", msgs.getMessage( "test.message" ) );
    }
View Full Code Here

Examples of hivemind.test.services.SimpleModule

        verifyControls();
    }

    public void testIntegration() throws Exception
    {
        Registry r = buildFrameworkRegistry(new SimpleModule());

        SimpleService a = (SimpleService) r.getService(SimpleService.class);

        AdderWrapper aw1 = new AdderWrapper(a);
View Full Code Here

Examples of javango.conf.SimpleModule

  Client c;
  Injector injector;
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    injector = Guice.createInjector(new HibernateModule(), new SimpleModule("javango.polls.Settings"));   
    Configuration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
    c = new Client(injector);
  }
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.