prompto.config.IServerConfiguration Maven / Gradle / Ivy
package prompto.config;
import java.util.function.Supplier;
public interface IServerConfiguration extends IRuntimeConfiguration {
IHttpConfiguration getHttpConfiguration();
String getServerAboutToStartMethod();
String getWebSiteRoot();
boolean useConsole();
T withServerAboutToStartMethod(String method);
T withHttpConfiguration(IHttpConfiguration config);
T withUseConsole(boolean set);
@SuppressWarnings("unchecked")
public static class Inline extends IRuntimeConfiguration.Inline implements IServerConfiguration {
Supplier httpConfiguration = ()->null;
Supplier serverAboutToStartMethod = ()->null;
Supplier webSiteRoot = ()->null;
Supplier useConsole = ()->false;
@Override public IHttpConfiguration getHttpConfiguration() { return httpConfiguration.get(); }
@Override public String getServerAboutToStartMethod() { return serverAboutToStartMethod.get(); }
@Override public String getWebSiteRoot() { return webSiteRoot.get(); }
@Override public boolean useConsole() { return useConsole.get(); }
@Override
public T withServerAboutToStartMethod(String method) {
this.serverAboutToStartMethod = ()->method;
return (T)this;
}
@Override
public T withHttpConfiguration(IHttpConfiguration config) {
this.httpConfiguration = ()->config;
return (T)this;
}
@Override
public T withUseConsole(boolean set) {
this.useConsole = () -> set;
return (T)this;
}
}
}