All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.inverno.mod.boot.BootNetClientConfigurationLoader Maven / Gradle / Ivy

There is a newer version: 1.11.0
Show newest version
package io.inverno.mod.boot;

import io.inverno.mod.configuration.ConfigurationLoaderSupport;
import java.lang.Boolean;
import java.lang.Integer;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.annotation.processing.Generated;

@Generated(value="io.inverno.mod.configuration.compiler.internal.ConfigurationCompilerPlugin", date = "2024-03-06T16:16:01.409958624+01:00[Europe/Paris]")
public final class BootNetClientConfigurationLoader extends ConfigurationLoaderSupport {

	public BootNetClientConfigurationLoader() {
		super(
			new String[] {
				"io.inverno.mod.boot.bootNetClientConfiguration.reuse_address",
				"io.inverno.mod.boot.bootNetClientConfiguration.reuse_port",
				"io.inverno.mod.boot.bootNetClientConfiguration.keep_alive",
				"io.inverno.mod.boot.bootNetClientConfiguration.tcp_no_delay",
				"io.inverno.mod.boot.bootNetClientConfiguration.tcp_quickack",
				"io.inverno.mod.boot.bootNetClientConfiguration.tcp_cork",
				"io.inverno.mod.boot.bootNetClientConfiguration.linger",
				"io.inverno.mod.boot.bootNetClientConfiguration.rcv_buffer",
				"io.inverno.mod.boot.bootNetClientConfiguration.snd_buffer",
				"io.inverno.mod.boot.bootNetClientConfiguration.ip_tos",
				"io.inverno.mod.boot.bootNetClientConfiguration.connect_timeout",
				"io.inverno.mod.boot.bootNetClientConfiguration.tcp_fast_open_connect"
			},
			results -> bootNetClientConfiguration_configurator -> {
				results.get(0).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.reuse_address(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(1).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.reuse_port(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(2).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.keep_alive(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(3).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.tcp_no_delay(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(4).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.tcp_quickack(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(5).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.tcp_cork(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
				results.get(6).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.linger(property.as(Integer.class).orElse(null)));
				results.get(7).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.rcv_buffer(property.as(Integer.class).orElse(null)));
				results.get(8).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.snd_buffer(property.as(Integer.class).orElse(null)));
				results.get(9).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.ip_tos(property.as(Integer.class).orElse(null)));
				results.get(10).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.connect_timeout(property.as(Integer.class).orElse(null)));
				results.get(11).getResult().ifPresent(property -> bootNetClientConfiguration_configurator.tcp_fast_open_connect(property.asBoolean().orElseGet(() -> (new boolean[1])[0])));
			},
			BootNetClientConfigurationLoader::load,
			BootNetClientConfigurationLoader.Configuration::new
		);
	}

	public static BootNetClientConfiguration load(Consumer configurer) {
		if(configurer == null) {
			return new BootNetClientConfigurationLoader.Configuration();
		}
		BootNetClientConfigurationLoader.Configurator configurator = new BootNetClientConfigurationLoader.Configurator();
		configurer.accept(configurator);
		return new BootNetClientConfigurationLoader.Configuration(configurator.reuse_address, configurator.reuse_port, configurator.keep_alive, configurator.tcp_no_delay, configurator.tcp_quickack, configurator.tcp_cork, configurator.linger, configurator.rcv_buffer, configurator.snd_buffer, configurator.ip_tos, configurator.connect_timeout, configurator.tcp_fast_open_connect);
	}

	public static BootNetClientConfiguration load(BootNetClientConfiguration configuration, Consumer configurer) {
		if(configurer == null) {
			return configuration;
		}
		Consumer rootConfigurer = configurator -> configurator
			.reuse_address(configuration.reuse_address())
			.reuse_port(configuration.reuse_port())
			.keep_alive(configuration.keep_alive())
			.tcp_no_delay(configuration.tcp_no_delay())
			.tcp_quickack(configuration.tcp_quickack())
			.tcp_cork(configuration.tcp_cork())
			.linger(configuration.linger())
			.rcv_buffer(configuration.rcv_buffer())
			.snd_buffer(configuration.snd_buffer())
			.ip_tos(configuration.ip_tos())
			.connect_timeout(configuration.connect_timeout())
			.tcp_fast_open_connect(configuration.tcp_fast_open_connect());

		BootNetClientConfigurationLoader.Configurator configurator = new BootNetClientConfigurationLoader.Configurator();
		rootConfigurer.andThen(configurer).accept(configurator);
		return new BootNetClientConfigurationLoader.Configuration(configurator.reuse_address, configurator.reuse_port, configurator.keep_alive, configurator.tcp_no_delay, configurator.tcp_quickack, configurator.tcp_cork, configurator.linger, configurator.rcv_buffer, configurator.snd_buffer, configurator.ip_tos, configurator.connect_timeout, configurator.tcp_fast_open_connect);
	}

	private static final class Configuration implements BootNetClientConfiguration {

		private boolean reuse_address = BootNetClientConfiguration.super.reuse_address();
		private boolean reuse_port = BootNetClientConfiguration.super.reuse_port();
		private boolean keep_alive = BootNetClientConfiguration.super.keep_alive();
		private boolean tcp_no_delay = BootNetClientConfiguration.super.tcp_no_delay();
		private boolean tcp_quickack = BootNetClientConfiguration.super.tcp_quickack();
		private boolean tcp_cork = BootNetClientConfiguration.super.tcp_cork();
		private Integer linger;
		private Integer rcv_buffer;
		private Integer snd_buffer;
		private Integer ip_tos;
		private Integer connect_timeout = BootNetClientConfiguration.super.connect_timeout();
		private boolean tcp_fast_open_connect = BootNetClientConfiguration.super.tcp_fast_open_connect();

		private Configuration() {}

		public Configuration(Supplier reuse_address, Supplier reuse_port, Supplier keep_alive, Supplier tcp_no_delay, Supplier tcp_quickack, Supplier tcp_cork, Supplier linger, Supplier rcv_buffer, Supplier snd_buffer, Supplier ip_tos, Supplier connect_timeout, Supplier tcp_fast_open_connect) {
			Optional.ofNullable(reuse_address).ifPresent(s -> this.reuse_address = s.get());
			Optional.ofNullable(reuse_port).ifPresent(s -> this.reuse_port = s.get());
			Optional.ofNullable(keep_alive).ifPresent(s -> this.keep_alive = s.get());
			Optional.ofNullable(tcp_no_delay).ifPresent(s -> this.tcp_no_delay = s.get());
			Optional.ofNullable(tcp_quickack).ifPresent(s -> this.tcp_quickack = s.get());
			Optional.ofNullable(tcp_cork).ifPresent(s -> this.tcp_cork = s.get());
			Optional.ofNullable(linger).ifPresent(s -> this.linger = s.get());
			Optional.ofNullable(rcv_buffer).ifPresent(s -> this.rcv_buffer = s.get());
			Optional.ofNullable(snd_buffer).ifPresent(s -> this.snd_buffer = s.get());
			Optional.ofNullable(ip_tos).ifPresent(s -> this.ip_tos = s.get());
			Optional.ofNullable(connect_timeout).ifPresent(s -> this.connect_timeout = s.get());
			Optional.ofNullable(tcp_fast_open_connect).ifPresent(s -> this.tcp_fast_open_connect = s.get());
		}

		public boolean reuse_address() {
			 return this.reuse_address;
		}

		public boolean reuse_port() {
			 return this.reuse_port;
		}

		public boolean keep_alive() {
			 return this.keep_alive;
		}

		public boolean tcp_no_delay() {
			 return this.tcp_no_delay;
		}

		public boolean tcp_quickack() {
			 return this.tcp_quickack;
		}

		public boolean tcp_cork() {
			 return this.tcp_cork;
		}

		public Integer linger() {
			 return this.linger;
		}

		public Integer rcv_buffer() {
			 return this.rcv_buffer;
		}

		public Integer snd_buffer() {
			 return this.snd_buffer;
		}

		public Integer ip_tos() {
			 return this.ip_tos;
		}

		public Integer connect_timeout() {
			 return this.connect_timeout;
		}

		public boolean tcp_fast_open_connect() {
			 return this.tcp_fast_open_connect;
		}
	}

	public static final class Configurator {

		private Supplier reuse_address;
		private Supplier reuse_port;
		private Supplier keep_alive;
		private Supplier tcp_no_delay;
		private Supplier tcp_quickack;
		private Supplier tcp_cork;
		private Supplier linger;
		private Supplier rcv_buffer;
		private Supplier snd_buffer;
		private Supplier ip_tos;
		private Supplier connect_timeout;
		private Supplier tcp_fast_open_connect;

		private Configurator() {}

		public Configurator reuse_address(boolean reuse_address) {
			this.reuse_address = () -> reuse_address;
			return this;
		}

		public Configurator reuse_port(boolean reuse_port) {
			this.reuse_port = () -> reuse_port;
			return this;
		}

		public Configurator keep_alive(boolean keep_alive) {
			this.keep_alive = () -> keep_alive;
			return this;
		}

		public Configurator tcp_no_delay(boolean tcp_no_delay) {
			this.tcp_no_delay = () -> tcp_no_delay;
			return this;
		}

		public Configurator tcp_quickack(boolean tcp_quickack) {
			this.tcp_quickack = () -> tcp_quickack;
			return this;
		}

		public Configurator tcp_cork(boolean tcp_cork) {
			this.tcp_cork = () -> tcp_cork;
			return this;
		}

		public Configurator linger(Integer linger) {
			this.linger = () -> linger;
			return this;
		}

		public Configurator rcv_buffer(Integer rcv_buffer) {
			this.rcv_buffer = () -> rcv_buffer;
			return this;
		}

		public Configurator snd_buffer(Integer snd_buffer) {
			this.snd_buffer = () -> snd_buffer;
			return this;
		}

		public Configurator ip_tos(Integer ip_tos) {
			this.ip_tos = () -> ip_tos;
			return this;
		}

		public Configurator connect_timeout(Integer connect_timeout) {
			this.connect_timeout = () -> connect_timeout;
			return this;
		}

		public Configurator tcp_fast_open_connect(boolean tcp_fast_open_connect) {
			this.tcp_fast_open_connect = () -> tcp_fast_open_connect;
			return this;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy