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

Java.libraries.vertx.rxApiImpl.mustache Maven / Gradle / Ivy

There is a newer version: 3.0.0-rc1
Show newest version
package {{package}}.rxjava;

{{#imports}}import {{import}};
{{/imports}}

import java.util.*;

import rx.Single;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

{{>generatedAnnotation}}
{{#operations}}
public class {{classname}} {

	private final {{package}}.{{classname}} delegate;

	public {{classname}}({{package}}.{{classname}} delegate) {
	    this.delegate = delegate;
    }

	public {{package}}.{{classname}} getDelegate() {
	    return delegate;
	}

    {{#operation}}
    /**
     * {{summary}}
     * {{notes}}
     {{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
     {{/allParams}}
     * @param resultHandler Asynchronous result handler
     */
    public void {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}Handler> resultHandler) {
        delegate.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}resultHandler);
    }

    /**
     * {{summary}}
     * {{notes}}
     {{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
     {{/allParams}}
     * @return Asynchronous result handler (RxJava Single)
     */
    public Single<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> rx{{operationIdCamelCase}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
        return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
            delegate.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}fut);
        }));
    }
    {{/operation}}

    public static {{classname}} newInstance({{package}}.{{classname}} arg) {
        return arg != null ? new {{classname}}(arg) : null;
    }
}
{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy