class DefaultMessageMapperFactory implements MessageMapperFactory {

    Optional<MessageMapper> createMessageMapperInstance(final String mappingEngine) {
        if (registeredMappers.containsKey(mappingEngine)) {
            final Class<?> messageMapperClass = registeredMappers.get(mappingEngine);
            MessageMapper result = createAnyMessageMapper(messageMapperClass,
                    actorSystem.dynamicAccess());
            for (final MessageMapperExtension extension : messageMapperExtensions) {
                if (null == result) {
                    return Optional.empty();
                }
                result = extension.apply(connectionId, result, actorSystem);
            }
            return Optional.ofNullable(result);
        } else {
            log.info("Mapper {} not found.", mappingEngine);
            return Optional.empty();
        }
    }

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

}