Class WithObjectMapper.WithObjectMapperBuilder

java.lang.Object
fr.ght1pc9kc.testy.core.extensions.WithObjectMapper.WithObjectMapperBuilder
Enclosing class:
WithObjectMapper

public static class WithObjectMapper.WithObjectMapperBuilder extends Object
Allow to build a more complex ObjectMapper with Module and Mixin

Usage :

     @RegisterExtension
     WithObjectMapper wMapper = WithObjectMapper.builder()
             .dontFindAndRegisterModules()
             .addModule(new ParameterNamesModule())
             .addModule(new JSR310Module())
             .addMixin(Dummy.class, DummyMixin.class)
             .build();
 
  • Constructor Details

    • WithObjectMapperBuilder

      public WithObjectMapperBuilder()
  • Method Details

    • dontFindAndRegisterModules

      public WithObjectMapper.WithObjectMapperBuilder dontFindAndRegisterModules()
      Avoid looking for Modules in classpath and register there
      Returns:
      the builder
    • addModule

      public WithObjectMapper.WithObjectMapperBuilder addModule(com.fasterxml.jackson.databind.Module module)
      Register specific Module to ObjectMapper
      Parameters:
      module - The Module to register
      Returns:
      the builder
    • addModules

      public WithObjectMapper.WithObjectMapperBuilder addModules(Collection<com.fasterxml.jackson.databind.Module> modules)
      Register multiple Modules at the same time
      Parameters:
      modules - The collection of Modules to register
      Returns:
      the builder
    • addMixin

      public WithObjectMapper.WithObjectMapperBuilder addMixin(Class<?> entityClass, Class<?> mixinClass)
      Register Mixin to the ObjectMapper
      Parameters:
      entityClass - The entity class
      mixinClass - The Mixin classe
      Returns:
      the builder
    • build

      public WithObjectMapper build()
      Build the Object Mapper junit extension
      Returns:
      The extension