class DefaultMessageMapperFactory implements MessageMapperFactory {

    @Override
    public Optional<MessageMapper> mapperOf(final String mapperId, final MappingContext mappingContext) {
        final Optional<MessageMapper> mapper = createMessageMapperInstance(mappingContext.getMappingEngine());
        final Map<String, String> configuredIncomingConditions = mappingContext.getIncomingConditions();
        final Map<String, String> configuredOutgoingConditions = mappingContext.getOutgoingConditions();
        final JsonObject defaultOptions =
                mapper.map(MessageMapper::getDefaultOptions).orElse(JsonObject.empty());
        final MergedJsonObjectMap configuredAndDefaultOptions =
                mergeMappingOptions(defaultOptions, mappingContext.getOptionsAsJson());
        final MessageMapperConfiguration options =
                DefaultMessageMapperConfiguration.of(mapperId, configuredAndDefaultOptions,
                        configuredIncomingConditions, configuredOutgoingConditions);
        return mapper.flatMap(m -> configureInstance(m, options));
    }

    private  DefaultMessageMapperFactory(final ConnectionId connectionId,
            final MappingConfig mappingConfig,
            final ExtendedActorSystem actorSystem,
            final List<MessageMapperExtension> messageMapperExtensions,
            final LoggingAdapter log);

}