// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.component; import java.util.*; import static com.yahoo.container.jdisc.JdiscBindingsConfig.Handlers; /** * @author gjoranv * @since 5.1.8 */ public class DiscBindingsConfigGenerator { public static Map generate(Collection> handlers) { Map handlerBuilders = new LinkedHashMap<>(); for (Handler handler : handlers) { handlerBuilders.putAll(generate(handler)); } return handlerBuilders; } public static > Map generate(T handler) { if (handler.getServerBindings().isEmpty() && handler.getClientBindings().isEmpty()) return Collections.emptyMap(); return Collections.singletonMap(handler.model.getComponentId().stringValue(), new Handlers.Builder() .serverBindings(handler.getServerBindings()) .clientBindings(handler.getClientBindings())); } }