class DefaultApplicationIdBuilder implements ApplicationIdBuilder, StreamsExecutionEnvironmentAware {

    @Override
    public ApplicationId buildApplicationId(final TopologyMetadata metadata, final Conf streamsConfig) {
        var id = streamsConfig.getOptionalString("streams." + StreamsConfig.APPLICATION_ID_CONFIG);
        return id.map(ApplicationId::new).orElseGet(() -> new ApplicationId(normalize(build(metadata, environment))));
    }

}