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

org.kiwiproject.dropwizard.util.bundle.PortAssigners Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package org.kiwiproject.dropwizard.util.bundle;

import lombok.experimental.UtilityClass;
import org.kiwiproject.dropwizard.util.startup.AllowablePortRange;
import org.kiwiproject.dropwizard.util.startup.PortAssigner;
import org.kiwiproject.dropwizard.util.startup.PortAssigner.PortAssignment;
import org.kiwiproject.dropwizard.util.startup.PortAssigner.PortSecurity;

@UtilityClass
class PortAssigners {

    static PortAssignment portAssignmentFrom(DynamicPortsConfiguration dynamicPortsConfig) {
        return PortAssignment.fromBooleanDynamicWhenTrue(dynamicPortsConfig.isUseDynamicPorts());
    }

    static PortAssignment portAssignmentFrom(StartupLockConfiguration startupLockConfig) {
        return PortAssignment.fromBooleanDynamicWhenTrue(startupLockConfig.isUseDynamicPorts());
    }

    static AllowablePortRange allowablePortRangeFrom(DynamicPortsConfiguration dynamicPortsConfig) {
        return new AllowablePortRange(dynamicPortsConfig.getMinDynamicPort(), dynamicPortsConfig.getMaxDynamicPort());
    }

    static PortAssigner.PortSecurity portSecurityFrom(DynamicPortsConfiguration dynamicPortsConfig) {
        return PortSecurity.fromBooleanSecureWhenTrue(dynamicPortsConfig.isUseSecureDynamicPorts());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy