Class MapperManager.Builder

java.lang.Object
io.helidon.common.mapper.MapperManager.Builder
All Implemented Interfaces:
Builder<MapperManager.Builder,MapperManager>, Supplier<MapperManager>
Enclosing interface:
MapperManager

public static final class MapperManager.Builder extends Object implements Builder<MapperManager.Builder,MapperManager>
Fluent API builder for MapperManager.
  • Method Details

    • build

      public MapperManager build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<MapperManager.Builder,MapperManager>
      Returns:
      instance of the built type
    • addMapperProvider

      public MapperManager.Builder addMapperProvider(MapperProvider provider)
      Add a new MapperProvider to the list of providers loaded from system service loader.

      You can control whether discovered services are loaded through see discoverServices(boolean)

      Parameters:
      provider - prioritized mapper provider to use
      Returns:
      updated builder instance
    • addMapperProvider

      public MapperManager.Builder addMapperProvider(MapperProvider provider, int priority)
      Add a new MapperProvider to the list of providers loaded from system service loader with a custom priority.
      Parameters:
      provider - a mapper provider instance
      priority - priority of the provider (see HelidonServiceLoader documentation for details about priority handling)
      Returns:
      updated builder instance
      See Also:
    • addMapper

      public <S, T> MapperManager.Builder addMapper(Mapper<S,T> mapper, Class<S> sourceType, Class<T> targetType, String... qualifiers)
      Add a mapper to the list of mapper.
      Type Parameters:
      S - type of source
      T - type of target
      Parameters:
      mapper - the mapper to map source instances to target instances
      sourceType - class of the source instance
      targetType - class of the target instance
      qualifiers - supported qualifiers of this mapper (if none provided, will return a compatible response)
      Returns:
      updated builder instance
    • addMapper

      public <S, T> MapperManager.Builder addMapper(Mapper<S,T> mapper, Class<S> sourceType, Class<T> targetType, double weight, String... qualifiers)
      Add a mapper to the list of mapper with a custom priority.
      Type Parameters:
      S - type of source
      T - type of target
      Parameters:
      mapper - the mapper to map source instances to target instances
      sourceType - class of the source instance
      targetType - class of the target instance
      weight - weight of the mapper
      qualifiers - supported qualifiers of this mapper (if none provided, will return a compatible response)
      Returns:
      updated builder instance
    • addMapper

      public <S, T> MapperManager.Builder addMapper(Mapper<S,T> mapper, GenericType<S> sourceType, GenericType<T> targetType, String... qualifiers)
      Add a mapper to the list of mapper.
      Type Parameters:
      S - type of source
      T - type of target
      Parameters:
      mapper - the mapper to map source instances to target instances
      sourceType - generic type of the source instance
      targetType - generic type of the target instance
      qualifiers - qualifiers of this mapper, if empty, will be a compatible mapper
      Returns:
      updated builder instance
    • addMapper

      public <S, T> MapperManager.Builder addMapper(Mapper<S,T> mapper, GenericType<S> sourceType, GenericType<T> targetType, double weight, String... qualifiers)
      Add a mapper to the list of mapper with custom priority.
      Type Parameters:
      S - type of source
      T - type of target
      Parameters:
      mapper - the mapper to map source instances to target instances
      sourceType - generic type of the source instance
      targetType - generic type of the target instance
      weight - weight of the mapper
      qualifiers - qualifiers of this mapper, if empty, will be a compatible mapper
      Returns:
      updated builder instance
    • useBuiltIn

      public MapperManager.Builder useBuiltIn(boolean useBuiltIn)
      Whether to use built-in mappers.
      Parameters:
      useBuiltIn - whether to use built in mappers (such as String to Integer)
      Returns:
      updated builder
    • discoverServices

      public MapperManager.Builder discoverServices(boolean discoverServices)
      Whether to use ServiceLoader to discover mappers, defaults to true.
      Parameters:
      discoverServices - whether to discover services
      Returns:
      updated builder