导航菜单

页面标题

页面副标题

Online Loans v421.2.42 - Generator.java 源代码

正在查看: Online Loans v421.2.42 应用的 Generator.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package org.infobip.mobile.messaging.api.support;

import j$.util.concurrent.ConcurrentHashMap;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Properties;
import lombok.Generated;
import lombok.NonNull;
import org.infobip.mobile.messaging.api.support.http.ApiKey;
import org.infobip.mobile.messaging.api.support.http.Body;
import org.infobip.mobile.messaging.api.support.http.Credentials;
import org.infobip.mobile.messaging.api.support.http.Header;
import org.infobip.mobile.messaging.api.support.http.Headers;
import org.infobip.mobile.messaging.api.support.http.HttpRequest;
import org.infobip.mobile.messaging.api.support.http.Path;
import org.infobip.mobile.messaging.api.support.http.Paths;
import org.infobip.mobile.messaging.api.support.http.Queries;
import org.infobip.mobile.messaging.api.support.http.Query;
import org.infobip.mobile.messaging.api.support.http.Version;
import org.infobip.mobile.messaging.api.support.http.client.DefaultApiClient;
import org.infobip.mobile.messaging.api.support.http.client.HttpMethod;
import org.infobip.mobile.messaging.api.support.http.client.Logger;
import org.infobip.mobile.messaging.api.support.http.client.RequestInterceptor;
import org.infobip.mobile.messaging.api.support.http.client.ResponsePreProcessor;
import org.infobip.mobile.messaging.api.support.util.ReflectionUtils;
import org.infobip.mobile.messaging.api.support.util.StringUtils;

public class Generator {
    private DefaultApiClient apiClient;
    private String baseUrl = "https://mobile.infobip.com/";
    private ConcurrentHashMap<Class<?>, CachingInvocationHandler> proxyCacheMap = new ConcurrentHashMap<>();
    private Properties properties = System.getProperties();
    private int connectTimeout = DefaultApiClient.DEFAULT_CONNECT_TIMEOUT;
    private int readTimeout = DefaultApiClient.DEFAULT_READ_TIMEOUT;
    private String[] userAgentAdditions = new String[0];
    private RequestInterceptor[] requestInterceptors = new RequestInterceptor[0];
    private ResponsePreProcessor[] responsePreProcessors = new ResponsePreProcessor[0];
    private Logger logger = new Logger();
    private boolean allowUntrustedSSLOnError = false;

    public static class Builder {
        private final Generator generator = new Generator();

        public Generator build() {
            if (StringUtils.isBlank(this.generator.getBaseUrl())) {
                throw new IllegalArgumentException("baseUrl is mandatory");
            }
            return this.generator;
        }

        public Builder withAllowUntrustedSSLOnError(boolean z) {
            this.generator.allowUntrustedSSLOnError = z;
            return this;
        }

        public Builder withBaseUrl(@NonNull String str) {
            if (str == null) {
                throw new NullPointerException("baseUrl is marked non-null but is null");
            }
            this.generator.setBaseUrl(str);
            return this;
        }

        public Builder withConnectTimeout(int i) {
            this.generator.setConnectTimeout(i);
            return this;
        }

        public Builder withLogger(@NonNull Logger logger) {
            if (logger == null) {
                throw new NullPointerException("logger is marked non-null but is null");
            }
            this.generator.logger = logger;
            return this;
        }

        public Builder withProperties(@NonNull Properties properties) {
            if (properties == null) {
                throw new NullPointerException("properties is marked non-null but is null");
            }
            this.generator.setProperties(properties);
            return this;
        }

        public Builder withReadTimeout(int i) {
            this.generator.setReadTimeout(i);
            return this;
        }

        public Builder withRequestInterceptors(@NonNull RequestInterceptor... requestInterceptorArr) {
            if (requestInterceptorArr == null) {
                throw new NullPointerException("requestInterceptors is marked non-null but is null");
            }
            this.generator.requestInterceptors = requestInterceptorArr;
            return this;
        }

        public Builder withResponseHeaderInterceptors(@NonNull ResponsePreProcessor... responsePreProcessorArr) {
            if (responsePreProcessorArr == null) {
                throw new NullPointerException("responsePreProcessors is marked non-null but is null");
            }
            this.generator.responsePreProcessors = responsePreProcessorArr;
            return this;
        }

        public Builder withUserAgentAdditions(@NonNull String... strArr) {
            if (strArr == null) {
                throw new NullPointerException("userAgentAdditions is marked non-null but is null");
            }
            this.generator.setUserAgentAdditions(strArr);
            return this;
        }
    }

    public class CachingInvocationHandler<T> implements InvocationHandler {
        private ConcurrentHashMap<Method, ProxyCache> proxyCacheMap = new ConcurrentHashMap<>();
        private final Class<T> type;

        @Generated
        public CachingInvocationHandler(Class<T> cls) {
            this.type = cls;
        }

        private HttpMethod getHttpRequestMethod(HttpRequest[] httpRequestArr) {
            HttpMethod httpMethod = HttpMethod.GET;
            for (HttpRequest httpRequest : httpRequestArr) {
                httpMethod = httpRequest.method();
            }
            return httpMethod;
        }

        private ProxyCache getProxyCache(Method method) {
            ProxyCache proxyCache = (ProxyCache) this.proxyCacheMap.get(method);
            if (proxyCache != null) {
                return proxyCache;
            }
            ProxyCache proxyCache2 = Generator.this.new ProxyCache(method);
            this.proxyCacheMap.put(method, proxyCache2);
            return proxyCache2;
        }

        @Generated
        public boolean canEqual(Object obj) {
            return obj instanceof CachingInvocationHandler;
        }

        @Generated
        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof CachingInvocationHandler)) {
                return false;
            }
            CachingInvocationHandler cachingInvocationHandler = (CachingInvocationHandler) obj;
            if (!cachingInvocationHandler.canEqual(this)) {
                return false;
            }
            Class<T> type = getType();
            Class<T> type2 = cachingInvocationHandler.getType();
            if (type != null ? !type.equals(type2) : type2 != null) {
                return false;
            }
            ConcurrentHashMap<Method, ProxyCache> proxyCacheMap = getProxyCacheMap();
            ConcurrentHashMap<Method, ProxyCache> proxyCacheMap2 = cachingInvocationHandler.getProxyCacheMap();
            return proxyCacheMap != null ? proxyCacheMap.equals(proxyCacheMap2) : proxyCacheMap2 == null;
        }

        public T getProxy() {
            return (T) Proxy.newProxyInstance(this.type.getClassLoader(), new Class[]{this.type}, this);
        }

        @Generated
        public ConcurrentHashMap<Method, ProxyCache> getProxyCacheMap() {
            return this.proxyCacheMap;
        }

        @Generated
        public Class<T> getType() {
            return this.type;
        }

        @Generated
        public int hashCode() {
            Class<T> type = getType();
            int hashCode = type == null ? 43 : type.hashCode();
            ConcurrentHashMap<Method, ProxyCache> proxyCacheMap = getProxyCacheMap();
            return ((hashCode + 59) * 59) + (proxyCacheMap != null ? proxyCacheMap.hashCode() : 43);
        }

        @Override
        public Object invoke(Object obj, Method method, Object[] objArr) throws Throwable {
            Parameter[] parameterArr;
            ProxyCache proxyCache = getProxyCache(method);
            String join = StringUtils.join("/", Generator.this.baseUrl, proxyCache.getUri());
            HashMap hashMap = new HashMap(proxyCache.getDefaultQueryParams());
            HashMap hashMap2 = new HashMap(proxyCache.getDefaultHeaderMap());
            String apiKey = proxyCache.getApiKey();
            Tuple<String, String> credentials = proxyCache.getCredentials();
            Parameter[] parameters = proxyCache.getParameters();
            int length = parameters.length;
            Object obj2 = null;
            int i = 0;
            while (i < length) {
                Parameter parameter = parameters[i];
                Object obj3 = objArr[i];
                if (parameter.getBody() != null) {
                    obj2 = obj3;
                }
                if (parameter.getVersion() != null) {
                    join = join.replace("{version}", obj3.toString());
                }
                Path path = parameter.getPath();
                if (path != null) {
                    StringBuilder sb = new StringBuilder();
                    parameterArr = parameters;
                    sb.append("{");
                    sb.append(path.name());
                    sb.append("}");
                    join = join.replace(sb.toString(), obj3.toString());
                } else {
                    parameterArr = parameters;
                }
                Query query = parameter.getQuery();
                if (query != null) {
                    String name = query.name();
                    Collection collection = Generator.this.toCollection(obj3);
                    if (collection != null) {
                        hashMap.put(name, collection);
                    }
                }
                Header header = parameter.getHeader();
                if (header != null) {
                    hashMap2.put(header.name(), Generator.this.toCollection(obj3));
                }
                i++;
                parameters = parameterArr;
            }
            return Generator.this.getApiClient().execute(getHttpRequestMethod(proxyCache.httpRequests), join.endsWith("/") ? join.substring(0, join.length() - 1) : join, apiKey, credentials, hashMap, hashMap2, obj2, method.getReturnType());
        }

        @Generated
        public void setProxyCacheMap(ConcurrentHashMap<Method, ProxyCache> concurrentHashMap) {
            this.proxyCacheMap = concurrentHashMap;
        }

        @Generated
        public String toString() {
            return "Generator.CachingInvocationHandler(type=" + getType() + ", proxyCacheMap=" + getProxyCacheMap() + ")";
        }
    }

    public class Parameter {
        private final Body body;
        private final Header header;
        private final Path path;
        private final Query query;
        private final Version version;

        @Generated
        public Parameter(Body body, Path path, Query query, Header header, Version version) {
            this.body = body;
            this.path = path;
            this.query = query;
            this.header = header;
            this.version = version;
        }

        @Generated
        public boolean canEqual(Object obj) {
            return obj instanceof Parameter;
        }

        @Generated
        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof Parameter)) {
                return false;
            }
            Parameter parameter = (Parameter) obj;
            if (!parameter.canEqual(this)) {
                return false;
            }
            Body body = getBody();
            Body body2 = parameter.getBody();
            if (body != null ? !body.equals(body2) : body2 != null) {
                return false;
            }
            Path path = getPath();
            Path path2 = parameter.getPath();
            if (path != null ? !path.equals(path2) : path2 != null) {
                return false;
            }
            Query query = getQuery();
            Query query2 = parameter.getQuery();
            if (query != null ? !query.equals(query2) : query2 != null) {
                return false;
            }
            Header header = getHeader();
            Header header2 = parameter.getHeader();
            if (header != null ? !header.equals(header2) : header2 != null) {
                return false;
            }
            Version version = getVersion();
            Version version2 = parameter.getVersion();
            return version != null ? version.equals(version2) : version2 == null;
        }

        @Generated
        public Body getBody() {
            return this.body;
        }

        @Generated
        public Header getHeader() {
            return this.header;
        }

        @Generated
        public Path getPath() {
            return this.path;
        }

        @Generated
        public Query getQuery() {
            return this.query;
        }

        @Generated
        public Version getVersion() {
            return this.version;
        }

        @Generated
        public int hashCode() {
            Body body = getBody();
            int hashCode = body == null ? 43 : body.hashCode();
            Path path = getPath();
            int hashCode2 = ((hashCode + 59) * 59) + (path == null ? 43 : path.hashCode());
            Query query = getQuery();
            int hashCode3 = (hashCode2 * 59) + (query == null ? 43 : query.hashCode());
            Header header = getHeader();
            int hashCode4 = (hashCode3 * 59) + (header == null ? 43 : header.hashCode());
            Version version = getVersion();
            return (hashCode4 * 59) + (version != null ? version.hashCode() : 43);
        }

        @Generated
        public String toString() {
            return "Generator.Parameter(body=" + getBody() + ", path=" + getPath() + ", query=" + getQuery() + ", header=" + getHeader() + ", version=" + getVersion() + ")";
        }
    }

    @Generated
    public Generator() {
    }

    public <T> T getAnnotation(Annotation[] annotationArr, Class<T> cls) {
        for (Annotation annotation : annotationArr) {
            ?? r2 = (T) annotation;
            if (cls.isAssignableFrom(r2.annotationType())) {
                return r2;
            }
        }
        return null;
    }

    public DefaultApiClient getApiClient() {
        DefaultApiClient defaultApiClient = this.apiClient;
        if (defaultApiClient != null) {
            return defaultApiClient;
        }
        DefaultApiClient defaultApiClient2 = new DefaultApiClient(this.connectTimeout, this.readTimeout, this.properties.getProperty("library.version"), this.requestInterceptors, this.responsePreProcessors, this.logger, this.allowUntrustedSSLOnError, this.userAgentAdditions);
        this.apiClient = defaultApiClient2;
        return defaultApiClient2;
    }

    public ApiKey getApiKeyAnnotation(Method method) {
        ApiKey apiKey = (ApiKey) method.getAnnotation(ApiKey.class);
        if (apiKey != null) {
            return apiKey;
        }
        ApiKey apiKey2 = (ApiKey) method.getDeclaringClass().getAnnotation(ApiKey.class);
        return apiKey2 != null ? apiKey2 : (ApiKey) getPackageAnnotation(method.getDeclaringClass().getPackage().getName(), ApiKey.class);
    }

    public Credentials getCredentialsAnnotation(Method method) {
        Credentials credentials = (Credentials) method.getAnnotation(Credentials.class);
        if (credentials != null) {
            return credentials;
        }
        Credentials credentials2 = (Credentials) method.getDeclaringClass().getAnnotation(Credentials.class);
        return credentials2 != null ? credentials2 : (Credentials) getPackageAnnotation(method.getDeclaringClass().getPackage().getName(), Credentials.class);
    }

    private <T extends Annotation> T getPackageAnnotation(String str, Class<T> cls) {
        T t;
        Package r0 = Package.getPackage(str);
        if (r0 == null) {
            try {
                ReflectionUtils.loadPackageInfo(str);
                r0 = Package.getPackage(str);
            } catch (Exception unused) {
            }
        }
        if (r0 != null && (t = (T) r0.getAnnotation(cls)) != null) {
            return t;
        }
        if (str.length() == 0) {
            return null;
        }
        int lastIndexOf = str.lastIndexOf(46);
        return (T) getPackageAnnotation(lastIndexOf < 0 ? "" : str.substring(0, lastIndexOf), cls);
    }

    public Version getVersionAnnotation(Method method) {
        Version version = (Version) method.getAnnotation(Version.class);
        if (version != null) {
            return version;
        }
        Version version2 = (Version) method.getDeclaringClass().getAnnotation(Version.class);
        return version2 != null ? version2 : (Version) getPackageAnnotation(method.getDeclaringClass().getPackage().getName(), Version.class);
    }

    public Collection<Object> toCollection(Object obj) {
        if (obj == null) {
            return null;
        }
        if (obj instanceof Collection) {
            return (Collection) obj;
        }
        if (!obj.getClass().isArray()) {
            return Collections.singleton(obj);
        }
        int length = Array.getLength(obj);
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < length; i++) {
            arrayList.add(Array.get(obj, i));
        }
        return arrayList;
    }

    @Generated
    public boolean canEqual(Object obj) {
        return obj instanceof Generator;
    }

    public <T> T create(@NonNull Class<T> cls) {
        if (cls == null) {
            throw new NullPointerException("type is marked non-null but is null");
        }
        CachingInvocationHandler cachingInvocationHandler = (CachingInvocationHandler) this.proxyCacheMap.get(cls);
        if (cachingInvocationHandler == null) {
            cachingInvocationHandler = new CachingInvocationHandler(cls);
            this.proxyCacheMap.put(cls, cachingInvocationHandler);
        }
        return (T) cachingInvocationHandler.getProxy();
    }

    @Generated
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof Generator)) {
            return false;
        }
        Generator generator = (Generator) obj;
        if (!generator.canEqual(this) || getConnectTimeout() != generator.getConnectTimeout() || getReadTimeout() != generator.getReadTimeout() || isAllowUntrustedSSLOnError() != generator.isAllowUntrustedSSLOnError()) {
            return false;
        }
        DefaultApiClient apiClient = getApiClient();
        DefaultApiClient apiClient2 = generator.getApiClient();
        if (apiClient != null ? !apiClient.equals(apiClient2) : apiClient2 != null) {
            return false;
        }
        String baseUrl = getBaseUrl();
        String baseUrl2 = generator.getBaseUrl();
        if (baseUrl != null ? !baseUrl.equals(baseUrl2) : baseUrl2 != null) {
            return false;
        }
        ConcurrentHashMap<Class<?>, CachingInvocationHandler> proxyCacheMap = getProxyCacheMap();
        ConcurrentHashMap<Class<?>, CachingInvocationHandler> proxyCacheMap2 = generator.getProxyCacheMap();
        if (proxyCacheMap != null ? !proxyCacheMap.equals(proxyCacheMap2) : proxyCacheMap2 != null) {
            return false;
        }
        Properties properties = getProperties();
        Properties properties2 = generator.getProperties();
        if (properties != null ? !properties.equals(properties2) : properties2 != null) {
            return false;
        }
        if (!Arrays.deepEquals(getUserAgentAdditions(), generator.getUserAgentAdditions()) || !Arrays.deepEquals(getRequestInterceptors(), generator.getRequestInterceptors()) || !Arrays.deepEquals(getResponsePreProcessors(), generator.getResponsePreProcessors())) {
            return false;
        }
        Logger logger = getLogger();
        Logger logger2 = generator.getLogger();
        return logger != null ? logger.equals(logger2) : logger2 == null;
    }

    @Generated
    public String getBaseUrl() {
        return this.baseUrl;
    }

    @Generated
    public int getConnectTimeout() {
        return this.connectTimeout;
    }

    @Generated
    public Logger getLogger() {
        return this.logger;
    }

    @Generated
    public Properties getProperties() {
        return this.properties;
    }

    @Generated
    public ConcurrentHashMap<Class<?>, CachingInvocationHandler> getProxyCacheMap() {
        return this.proxyCacheMap;
    }

    @Generated
    public int getReadTimeout() {
        return this.readTimeout;
    }

    @Generated
    public RequestInterceptor[] getRequestInterceptors() {
        return this.requestInterceptors;
    }

    @Generated
    public ResponsePreProcessor[] getResponsePreProcessors() {
        return this.responsePreProcessors;
    }

    @Generated
    public String[] getUserAgentAdditions() {
        return this.userAgentAdditions;
    }

    @Generated
    public int hashCode() {
        int connectTimeout = ((((getConnectTimeout() + 59) * 59) + getReadTimeout()) * 59) + (isAllowUntrustedSSLOnError() ? 79 : 97);
        DefaultApiClient apiClient = getApiClient();
        int hashCode = (connectTimeout * 59) + (apiClient == null ? 43 : apiClient.hashCode());
        String baseUrl = getBaseUrl();
        int hashCode2 = (hashCode * 59) + (baseUrl == null ? 43 : baseUrl.hashCode());
        ConcurrentHashMap<Class<?>, CachingInvocationHandler> proxyCacheMap = getProxyCacheMap();
        int hashCode3 = (hashCode2 * 59) + (proxyCacheMap == null ? 43 : proxyCacheMap.hashCode());
        Properties properties = getProperties();
        int hashCode4 = (((((((hashCode3 * 59) + (properties == null ? 43 : properties.hashCode())) * 59) + Arrays.deepHashCode(getUserAgentAdditions())) * 59) + Arrays.deepHashCode(getRequestInterceptors())) * 59) + Arrays.deepHashCode(getResponsePreProcessors());
        Logger logger = getLogger();
        return (hashCode4 * 59) + (logger != null ? logger.hashCode() : 43);
    }

    @Generated
    public boolean isAllowUntrustedSSLOnError() {
        return this.allowUntrustedSSLOnError;
    }

    @Generated
    public void setAllowUntrustedSSLOnError(boolean z) {
        this.allowUntrustedSSLOnError = z;
    }

    @Generated
    public void setApiClient(DefaultApiClient defaultApiClient) {
        this.apiClient = defaultApiClient;
    }

    @Generated
    public void setBaseUrl(String str) {
        this.baseUrl = str;
    }

    @Generated
    public void setConnectTimeout(int i) {
        this.connectTimeout = i;
    }

    @Generated
    public void setLogger(Logger logger) {
        this.logger = logger;
    }

    @Generated
    public void setProperties(Properties properties) {
        this.properties = properties;
    }

    @Generated
    public void setProxyCacheMap(ConcurrentHashMap<Class<?>, CachingInvocationHandler> concurrentHashMap) {
        this.proxyCacheMap = concurrentHashMap;
    }

    @Generated
    public void setReadTimeout(int i) {
        this.readTimeout = i;
    }

    @Generated
    public void setRequestInterceptors(RequestInterceptor[] requestInterceptorArr) {
        this.requestInterceptors = requestInterceptorArr;
    }

    @Generated
    public void setResponsePreProcessors(ResponsePreProcessor[] responsePreProcessorArr) {
        this.responsePreProcessors = responsePreProcessorArr;
    }

    @Generated
    public void setUserAgentAdditions(String[] strArr) {
        this.userAgentAdditions = strArr;
    }

    @Generated
    public String toString() {
        return "Generator(apiClient=" + getApiClient() + ", baseUrl=" + getBaseUrl() + ", proxyCacheMap=" + getProxyCacheMap() + ", properties=" + getProperties() + ", connectTimeout=" + getConnectTimeout() + ", readTimeout=" + getReadTimeout() + ", userAgentAdditions=" + Arrays.deepToString(getUserAgentAdditions()) + ", requestInterceptors=" + Arrays.deepToString(getRequestInterceptors()) + ", responsePreProcessors=" + Arrays.deepToString(getResponsePreProcessors()) + ", logger=" + getLogger() + ", allowUntrustedSSLOnError=" + isAllowUntrustedSSLOnError() + ")";
    }

    public class ProxyCache {
        private final String apiKey;
        private final Tuple<String, String> credentials;
        private final HashMap<String, Collection<Object>> defaultHeaderMap;
        private final HashMap<String, Collection<Object>> defaultQueryParams;
        private final HttpRequest[] httpRequests;
        private final Parameter[] parameters;
        private final String uri;

        public ProxyCache(Method method) {
            this.httpRequests = createHttpRequest(method);
            this.uri = createUri(method);
            this.defaultQueryParams = createDefaultQueryParams(method);
            this.defaultHeaderMap = createDefaultHeaderMap(method);
            this.parameters = createParameters(method);
            this.apiKey = findApiKey(method);
            this.credentials = findCredentials(method);
        }

        private HashMap<String, Collection<Object>> createDefaultHeaderMap(Method method) {
            HashMap<String, Collection<Object>> hashMap = new HashMap<>();
            Header header = (Header) method.getAnnotation(Header.class);
            if (header != null) {
                hashMap.put(header.name(), injectProperty(header.value()));
            }
            Headers headers = (Headers) method.getAnnotation(Headers.class);
            if (headers != null) {
                for (Header header2 : headers.value()) {
                    hashMap.put(header2.name(), injectProperty(header2.value()));
                }
            }
            return hashMap;
        }

        private HashMap<String, Collection<Object>> createDefaultQueryParams(Method method) {
            HashMap<String, Collection<Object>> hashMap = new HashMap<>();
            Query query = (Query) method.getAnnotation(Query.class);
            if (query != null) {
                hashMap.put(query.name(), injectProperty(query.value()));
            }
            Queries queries = (Queries) method.getAnnotation(Queries.class);
            if (queries != null) {
                for (Query query2 : queries.value()) {
                    hashMap.put(query2.name(), injectProperty(query2.value()));
                }
            }
            return hashMap;
        }

        private HttpRequest[] createHttpRequest(Method method) {
            HttpRequest httpRequest = (HttpRequest) method.getDeclaringClass().getAnnotation(HttpRequest.class);
            HttpRequest httpRequest2 = (HttpRequest) method.getAnnotation(HttpRequest.class);
            if (httpRequest2 != null && httpRequest != null) {
                return new HttpRequest[]{httpRequest, httpRequest2};
            }
            if (httpRequest2 != null) {
                return new HttpRequest[]{httpRequest2};
            }
            if (httpRequest != null) {
                return new HttpRequest[]{httpRequest};
            }
            throw new NoHttpRequestAnnotation("Method '" + method.getName() + "' must be annotated with @HttpRequest!");
        }

        private Parameter[] createParameters(Method method) {
            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
            Parameter[] parameterArr = new Parameter[parameterAnnotations.length];
            int length = parameterAnnotations.length;
            int i = 0;
            int i2 = 0;
            while (i < length) {
                Annotation[] annotationArr = parameterAnnotations[i];
                Generator generator = Generator.this;
                parameterArr[i2] = generator.new Parameter((Body) generator.getAnnotation(annotationArr, Body.class), (Path) Generator.this.getAnnotation(annotationArr, Path.class), (Query) Generator.this.getAnnotation(annotationArr, Query.class), (Header) Generator.this.getAnnotation(annotationArr, Header.class), (Version) Generator.this.getAnnotation(annotationArr, Version.class));
                i++;
                i2++;
            }
            return parameterArr;
        }

        private String createUri(Method method) {
            String httpRequestValue = getHttpRequestValue();
            Version versionAnnotation = Generator.this.getVersionAnnotation(method);
            if (versionAnnotation != null) {
                httpRequestValue = httpRequestValue.replace("{version}", injectProperty(versionAnnotation.value()));
            }
            Path path = (Path) method.getAnnotation(Path.class);
            if (path != null) {
                httpRequestValue = httpRequestValue.replace("{" + path.name() + "}", injectProperty(path.value()));
            }
            Paths paths = (Paths) method.getAnnotation(Paths.class);
            if (paths != null) {
                for (Path path2 : paths.value()) {
                    httpRequestValue = httpRequestValue.replace("{" + path2.name() + "}", injectProperty(path2.value()));
                }
            }
            return httpRequestValue;
        }

        private String findApiKey(Method method) {
            ApiKey apiKeyAnnotation = Generator.this.getApiKeyAnnotation(method);
            if (apiKeyAnnotation == null) {
                return null;
            }
            return injectProperty(apiKeyAnnotation.value());
        }

        private Tuple<String, String> findCredentials(Method method) {
            Credentials credentialsAnnotation = Generator.this.getCredentialsAnnotation(method);
            if (credentialsAnnotation == null) {
                return null;
            }
            return new Tuple<>(injectProperty(credentialsAnnotation.user()), injectProperty(credentialsAnnotation.password()));
        }

        private String getHttpRequestValue() {
            String str = "";
            for (HttpRequest httpRequest : this.httpRequests) {
                str = StringUtils.join("/", str, httpRequest.value());
            }
            return str;
        }

        private String injectProperty(String str) {
            if (StringUtils.isBlank(str) || !str.startsWith("${") || !str.endsWith("}")) {
                return str;
            }
            String[] split = str.substring(2, str.length() - 1).split(":");
            return Generator.this.properties.getProperty(split[0], split.length > 1 ? split[1] : null);
        }

        @Generated
        public boolean canEqual(Object obj) {
            return obj instanceof ProxyCache;
        }

        @Generated
        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (!(obj instanceof ProxyCache)) {
                return false;
            }
            ProxyCache proxyCache = (ProxyCache) obj;
            if (!proxyCache.canEqual(this) || !Arrays.deepEquals(getHttpRequests(), proxyCache.getHttpRequests())) {
                return false;
            }
            String uri = getUri();
            String uri2 = proxyCache.getUri();
            if (uri != null ? !uri.equals(uri2) : uri2 != null) {
                return false;
            }
            HashMap<String, Collection<Object>> defaultQueryParams = getDefaultQueryParams();
            HashMap<String, Collection<Object>> defaultQueryParams2 = proxyCache.getDefaultQueryParams();
            if (defaultQueryParams != null ? !defaultQueryParams.equals(defaultQueryParams2) : defaultQueryParams2 != null) {
                return false;
            }
            HashMap<String, Collection<Object>> defaultHeaderMap = getDefaultHeaderMap();
            HashMap<String, Collection<Object>> defaultHeaderMap2 = proxyCache.getDefaultHeaderMap();
            if (defaultHeaderMap != null ? !defaultHeaderMap.equals(defaultHeaderMap2) : defaultHeaderMap2 != null) {
                return false;
            }
            if (!Arrays.deepEquals(getParameters(), proxyCache.getParameters())) {
                return false;
            }
            String apiKey = getApiKey();
            String apiKey2 = proxyCache.getApiKey();
            if (apiKey != null ? !apiKey.equals(apiKey2) : apiKey2 != null) {
                return false;
            }
            Tuple<String, String> credentials = getCredentials();
            Tuple<String, String> credentials2 = proxyCache.getCredentials();
            return credentials != null ? credentials.equals(credentials2) : credentials2 == null;
        }

        @Generated
        public String getApiKey() {
            return this.apiKey;
        }

        @Generated
        public Tuple<String, String> getCredentials() {
            return this.credentials;
        }

        @Generated
        public HashMap<String, Collection<Object>> getDefaultHeaderMap() {
            return this.defaultHeaderMap;
        }

        @Generated
        public HashMap<String, Collection<Object>> getDefaultQueryParams() {
            return this.defaultQueryParams;
        }

        @Generated
        public HttpRequest[] getHttpRequests() {
            return this.httpRequests;
        }

        @Generated
        public Parameter[] getParameters() {
            return this.parameters;
        }

        @Generated
        public String getUri() {
            return this.uri;
        }

        @Generated
        public int hashCode() {
            int deepHashCode = Arrays.deepHashCode(getHttpRequests()) + 59;
            String uri = getUri();
            int hashCode = (deepHashCode * 59) + (uri == null ? 43 : uri.hashCode());
            HashMap<String, Collection<Object>> defaultQueryParams = getDefaultQueryParams();
            int hashCode2 = (hashCode * 59) + (defaultQueryParams == null ? 43 : defaultQueryParams.hashCode());
            HashMap<String, Collection<Object>> defaultHeaderMap = getDefaultHeaderMap();
            int hashCode3 = (((hashCode2 * 59) + (defaultHeaderMap == null ? 43 : defaultHeaderMap.hashCode())) * 59) + Arrays.deepHashCode(getParameters());
            String apiKey = getApiKey();
            int hashCode4 = (hashCode3 * 59) + (apiKey == null ? 43 : apiKey.hashCode());
            Tuple<String, String> credentials = getCredentials();
            return (hashCode4 * 59) + (credentials != null ? credentials.hashCode() : 43);
        }

        @Generated
        public String toString() {
            return "Generator.ProxyCache(httpRequests=" + Arrays.deepToString(getHttpRequests()) + ", uri=" + getUri() + ", defaultQueryParams=" + getDefaultQueryParams() + ", defaultHeaderMap=" + getDefaultHeaderMap() + ", parameters=" + Arrays.deepToString(getParameters()) + ", apiKey=" + getApiKey() + ", credentials=" + getCredentials() + ")";
        }

        private Collection<Object> injectProperty(String[] strArr) {
            if (strArr == null) {
                return null;
            }
            ArrayList arrayList = new ArrayList();
            for (String str : strArr) {
                arrayList.add(injectProperty(str));
            }
            return arrayList;
        }
    }
}