Class WithJsonMapper.WithJsonMapperBuilder

java.lang.Object
fr.ght1pc9kc.testy.core.extensions.WithJsonMapper.WithJsonMapperBuilder
Enclosing class:
WithJsonMapper

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

Usage :

     @RegisterExtension
     WithJsonMapper wMapper = WithJsonMapper.builder()
             .dontFindAndRegisterModules()
             .addMixin(Dummy.class, DummyMixin.class)
             .build();
 
  • Constructor Details

    • WithJsonMapperBuilder

      public WithJsonMapperBuilder()
  • Method Details

    • dontFindAndRegisterModules

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

      public WithJsonMapper.WithJsonMapperBuilder addModule(tools.jackson.databind.JacksonModule module)
      Register specific Module to ObjectMapper
      Parameters:
      module - The Module to register
      Returns:
      the builder
    • addModules

      public WithJsonMapper.WithJsonMapperBuilder addModules(Collection<tools.jackson.databind.JacksonModule> modules)
      Register multiple JacksonModules at the same time
      Parameters:
      modules - The collection of Modules to register
      Returns:
      the builder
    • addMixin

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

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