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

io.gravitee.apim.common.mapper.HttpProxyOptionsMapperImpl Maven / Gradle / Ivy

The newest version!
package io.gravitee.apim.common.mapper;

import io.gravitee.definition.model.v4.http.HttpProxyOptions;
import io.gravitee.definition.model.v4.http.HttpProxyType;
import io.gravitee.node.vertx.client.http.VertxHttpProxyOptions;
import io.gravitee.node.vertx.client.http.VertxHttpProxyType;
import javax.annotation.processing.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2024-09-13T14:10:48+0000",
    comments = "version: 1.6.0.Beta2, compiler: javac, environment: Java 17.0.8 (Eclipse Adoptium)"
)
public class HttpProxyOptionsMapperImpl implements HttpProxyOptionsMapper {

    @Override
    public VertxHttpProxyOptions map(HttpProxyOptions httpProxyOptions) {
        if ( httpProxyOptions == null ) {
            return null;
        }

        VertxHttpProxyOptions.VertxHttpProxyOptionsBuilder vertxHttpProxyOptions = VertxHttpProxyOptions.builder();

        vertxHttpProxyOptions.enabled( httpProxyOptions.isEnabled() );
        vertxHttpProxyOptions.useSystemProxy( httpProxyOptions.isUseSystemProxy() );
        vertxHttpProxyOptions.host( httpProxyOptions.getHost() );
        vertxHttpProxyOptions.port( httpProxyOptions.getPort() );
        vertxHttpProxyOptions.username( httpProxyOptions.getUsername() );
        vertxHttpProxyOptions.password( httpProxyOptions.getPassword() );
        vertxHttpProxyOptions.type( httpProxyTypeToVertxHttpProxyType( httpProxyOptions.getType() ) );

        return vertxHttpProxyOptions.build();
    }

    protected VertxHttpProxyType httpProxyTypeToVertxHttpProxyType(HttpProxyType httpProxyType) {
        if ( httpProxyType == null ) {
            return null;
        }

        VertxHttpProxyType vertxHttpProxyType;

        switch ( httpProxyType ) {
            case HTTP: vertxHttpProxyType = VertxHttpProxyType.HTTP;
            break;
            case SOCKS4: vertxHttpProxyType = VertxHttpProxyType.SOCKS4;
            break;
            case SOCKS5: vertxHttpProxyType = VertxHttpProxyType.SOCKS5;
            break;
            default: throw new IllegalArgumentException( "Unexpected enum constant: " + httpProxyType );
        }

        return vertxHttpProxyType;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy