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

com.github.lontime.exthttp.provider.Provider Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.github.lontime.exthttp.provider;

import java.util.Map;

import com.github.lontime.base.commonj.components.ComponentLifecycle;
import com.github.lontime.base.commonj.constants.Consts;
import com.github.lontime.exthttp.common.Response;
import com.github.lontime.exthttp.container.DisposableServerWrapper;
import com.github.lontime.extjson.TypeReference;
import io.netty.handler.codec.http.DefaultHttpHeaders;
import io.netty.handler.codec.http.HttpHeaders;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClient;

/**
 * Provider.
 * @author lontime
 * @since 1.0
 */
public interface Provider extends AutoCloseable, ComponentLifecycle {

    /**
     * get.
     * @return HttpClient
     */
    default HttpClient get() {
        return get(Consts.DEFAULT_OBJECT_NAME);
    }

    /**
     * get.
     * @param name name
     * @return HttpClient
     */
    HttpClient get(String name);

    /**
     * getForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @return object
     */
     Mono> asyncGetForObject(String name, HttpHeaders headers, String uri, TypeReference clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncPostForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncDeleteForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncPatchForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPostForObject(String uri, Object body, TypeReference reference) {
        return asyncPostForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPostForObject(String name, String uri, Object body, TypeReference reference) {
        return asyncPostForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncPostForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncPostForObject(name, httpHeaders, uri, body, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String uri, Object body, TypeReference reference) {
        return postForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }


    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String name, String uri, Object body, TypeReference reference) {
        return postForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response postForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return postForObject(name, httpHeaders, uri, body, reference);
    }


    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference reference) {
        return asyncPostForObject(name, headers, uri, body, reference).blockOptional().orElse(null);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncDeleteForObject(String uri, Object body, TypeReference reference) {
        return asyncDeleteForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncDeleteForObject(String name, String uri, Object body, TypeReference reference) {
        return asyncDeleteForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncDeleteForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncDeleteForObject(name, httpHeaders, uri, body, reference);
    }

    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String uri, Object body, TypeReference reference) {
        return deleteForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }


    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String name, String uri, Object body, TypeReference reference) {
        return deleteForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response deleteForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return deleteForObject(name, httpHeaders, uri, body, reference);
    }


    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference reference) {
        return asyncDeleteForObject(name, headers, uri, body, reference).blockOptional().orElse(null);
    }

    /**
     * asyncPatchForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPatchForObject(String uri, Object body, TypeReference reference) {
        return asyncPatchForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPatchForObject(String name, String uri, Object body, TypeReference reference) {
        return asyncPatchForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * asyncPatchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncPatchForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncPatchForObject(name, httpHeaders, uri, body, reference);
    }

    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String uri, Object body, TypeReference reference) {
        return patchForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, reference);
    }


    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String name, String uri, Object body, TypeReference reference) {
        return patchForObject(name, new DefaultHttpHeaders(), uri,  body, reference);
    }

    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response patchForObject(String name, Map headers, String uri, Object body, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return patchForObject(name, httpHeaders, uri, body, reference);
    }


    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param reference clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String name, HttpHeaders headers, String uri, Object body, TypeReference reference) {
        return asyncPatchForObject(name, headers, uri, body, reference).blockOptional().orElse(null);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @return object
     */
    default  Response getForObject(String uri, TypeReference reference) {
        return getForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @return object
     */
    default  Response getForObject(String name, String uri, TypeReference reference) {
        return getForObject(name, new DefaultHttpHeaders(), uri, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @param headers headers
     * @return object
     */
    default  Response getForObject(String name, Map headers, String uri, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return getForObject(name, httpHeaders, uri, reference);
    }

    /**
     * getForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param reference clazz
     * @return object
     */
    default  Response getForObject(String name, HttpHeaders headers, String uri, TypeReference reference) {
        return asyncGetForObject(name, headers, uri, reference).blockOptional().orElse(null);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param reference clazz
     * @return object
     */
    default  Mono> asyncGetForObject(String uri, TypeReference reference) {
        return asyncGetForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference clazz
     * @return object
     */
    default  Mono> asyncGetForObject(String name, String uri, TypeReference reference) {
        return asyncGetForObject(name, new DefaultHttpHeaders(), uri, reference);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param reference reference
     * @param headers headers
     * @return object
     */
    default  Mono> asyncGetForObject(String name, Map headers, String uri, TypeReference reference) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncGetForObject(name, httpHeaders, uri, reference);
    }

    /**
     * getForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @return object
     */
     Mono> asyncGetForObject(String name, HttpHeaders headers, String uri, Class clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncPostForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncDeleteForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
     Mono> asyncPatchForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz);

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPostForObject(String uri, Object body, Class clazz) {
        return asyncPostForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPostForObject(String name, String uri, Object body, Class clazz) {
        return asyncPostForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncPostForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncPostForObject(name, httpHeaders, uri, body, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String uri, Object body, Class clazz) {
        return postForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String uri, Map headers, Object body, Class clazz) {
        return postForObject(Consts.DEFAULT_OBJECT_NAME, headers, uri,  body, clazz);
    }


    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String name, String uri, Object body, Class clazz) {
        return postForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response postForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return postForObject(name, httpHeaders, uri, body, clazz);
    }


    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response postForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz) {
        return asyncPostForObject(name, headers, uri, body, clazz).blockOptional().orElse(null);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncDeleteForObject(String uri, Object body, Class clazz) {
        return asyncDeleteForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncDeleteForObject(String name, String uri, Object body, Class clazz) {
        return asyncDeleteForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncDeleteForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncDeleteForObject(name, httpHeaders, uri, body, clazz);
    }

    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String uri, Object body, Class clazz) {
        return deleteForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }


    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String name, String uri, Object body, Class clazz) {
        return deleteForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response deleteForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return deleteForObject(name, httpHeaders, uri, body, clazz);
    }


    /**
     * deleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response deleteForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz) {
        return asyncDeleteForObject(name, headers, uri, body, clazz).blockOptional().orElse(null);
    }

    /**
     * asyncPatchForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPatchForObject(String uri, Object body, Class clazz) {
        return asyncPatchForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * asyncDeleteForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Mono> asyncPatchForObject(String name, String uri, Object body, Class clazz) {
        return asyncPatchForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * asyncPatchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Mono> asyncPatchForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncPatchForObject(name, httpHeaders, uri, body, clazz);
    }

    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String uri, Object body, Class clazz) {
        return patchForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri,  body, clazz);
    }


    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String name, String uri, Object body, Class clazz) {
        return patchForObject(name, new DefaultHttpHeaders(), uri,  body, clazz);
    }

    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param body body
     * @param headers headers
     * @return object
     */
    default  Response patchForObject(String name, Map headers, String uri, Object body, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return patchForObject(name, httpHeaders, uri, body, clazz);
    }


    /**
     * patchForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @param body body
     * @return object
     */
    default  Response patchForObject(String name, HttpHeaders headers, String uri, Object body, Class clazz) {
        return asyncPatchForObject(name, headers, uri, body, clazz).blockOptional().orElse(null);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @return object
     */
    default  Response getForObject(String uri, Class clazz) {
        return getForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @return object
     */
    default  Response getForObject(String name, String uri, Class clazz) {
        return getForObject(name, new DefaultHttpHeaders(), uri, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param headers headers
     * @return object
     */
    default  Response getForObject(String name, Map headers, String uri, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return getForObject(name, httpHeaders, uri, clazz);
    }

    /**
     * getForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param headers headers
     * @param clazz clazz
     * @return object
     */
    default  Response getForObject(String name, HttpHeaders headers, String uri, Class clazz) {
        return asyncGetForObject(name, headers, uri, clazz).blockOptional().orElse(null);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param clazz clazz
     * @return object
     */
    default  Mono> asyncGetForObject(String uri, Class clazz) {
        return asyncGetForObject(Consts.DEFAULT_OBJECT_NAME, new DefaultHttpHeaders(), uri, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @return object
     */
    default  Mono> asyncGetForObject(String name, String uri, Class clazz) {
        return asyncGetForObject(name, new DefaultHttpHeaders(), uri, clazz);
    }

    /**
     * postForObject.
     * @param  T
     * @param uri uri
     * @param name name
     * @param clazz clazz
     * @param headers headers
     * @return object
     */
    default  Mono> asyncGetForObject(String name, Map headers, String uri, Class clazz) {
        final DefaultHttpHeaders httpHeaders = new DefaultHttpHeaders();
        for (Map.Entry entry : headers.entrySet()) {
            httpHeaders.add(entry.getKey(), entry.getValue());
        }
        return asyncGetForObject(name, httpHeaders, uri, clazz);
    }

    /**
     * getServer.
     * @return DisposableServerWrapper
     */
    default DisposableServerWrapper getServer() {
        return getServer(Consts.DEFAULT_OBJECT_NAME);
    }

    /**
     * getServer.
     * @param name name
     * @return DisposableServerWrapper
     */
    DisposableServerWrapper getServer(String name);

    /**
     * close.
     */
    @Override
    void close();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy