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

com.github.charlemaznable.varys.impl.VarysProxyShansongAppDeveloperUrlProvider Maven / Gradle / Ivy

There is a newer version: 2023.0.4
Show newest version
package com.github.charlemaznable.varys.impl;

import com.github.charlemaznable.core.net.common.Mapping.UrlProvider;
import com.github.charlemaznable.varys.config.VarysConfig;
import com.google.inject.Inject;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Nullable;

import static com.github.charlemaznable.core.lang.Condition.checkNotNull;
import static com.github.charlemaznable.core.lang.Condition.nullThen;
import static com.github.charlemaznable.core.miner.MinerFactory.getMiner;
import static org.apache.commons.lang3.StringUtils.appendIfMissing;

@Component
public final class VarysProxyShansongAppDeveloperUrlProvider implements UrlProvider {

    private final VarysConfig varysConfig;

    public VarysProxyShansongAppDeveloperUrlProvider() {
        this(null);
    }

    @Inject
    @Autowired
    public VarysProxyShansongAppDeveloperUrlProvider(@Nullable VarysConfig varysConfig) {
        this.varysConfig = nullThen(varysConfig, () -> getMiner(VarysConfig.class));
    }

    @Override
    public String url(Class clazz) {
        val address = checkNotNull(varysConfig.address());
        return appendIfMissing(address, "/") + "proxy-shansong-app-developer";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy