当前位置: 首页>>代码示例>>Java>>正文


Java RxHelper.toFuture方法代码示例

本文整理汇总了Java中io.vertx.rx.java.RxHelper.toFuture方法的典型用法代码示例。如果您正苦于以下问题:Java RxHelper.toFuture方法的具体用法?Java RxHelper.toFuture怎么用?Java RxHelper.toFuture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.rx.java.RxHelper的用法示例。


在下文中一共展示了RxHelper.toFuture方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: observableToHandler

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public void observableToHandler() {
  Observer<HttpServer> observer = new Observer<HttpServer>() {
    @Override
    public void onNext(HttpServer o) {
    }
    @Override
    public void onError(Throwable e) {
    }
    @Override
    public void onCompleted() {
    }
  };
  Handler<AsyncResult<HttpServer>> handler = RxHelper.toFuture(observer);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:15,代码来源:NativeExamples.java

示例2: actionsToHandler

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public void actionsToHandler() {
  Action1<HttpServer> onNext = httpServer -> {};
  Action1<Throwable> onError = httpServer -> {};
  Action0 onComplete = () -> {};

  Handler<AsyncResult<HttpServer>> handler1 = RxHelper.toFuture(onNext);
  Handler<AsyncResult<HttpServer>> handler2 = RxHelper.toFuture(onNext, onError);
  Handler<AsyncResult<HttpServer>> handler3 = RxHelper.toFuture(onNext, onError, onComplete);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:10,代码来源:NativeExamples.java

示例3: testFulfillAdaptedSubscriber

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedSubscriber() {
  SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber.toObserver());
  o.handle(Future.succeededFuture("abc"));
  subscriber.assertItem("abc").assertCompleted().assertEmpty();
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:8,代码来源:AsyncResultHandlerTest.java

示例4: testRejectAdaptedSubscriber

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedSubscriber() {
  SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber.toObserver());
  Exception e = new Exception();
  o.handle(Future.failedFuture(e));
  subscriber.assertError(e).assertEmpty();
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:9,代码来源:AsyncResultHandlerTest.java

示例5: testFulfillAdaptedFunctions1

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions1() {
  List<String> items = new ArrayList<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add);
  o.handle(Future.succeededFuture("abc"));
  assertEquals(Collections.singletonList("abc"), items);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:8,代码来源:AsyncResultHandlerTest.java

示例6: testFulfillAdaptedFunctions2

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions2() {
  List<String> items = new ArrayList<>();
  List<Throwable> errors = new ArrayList<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add, errors::add);
  o.handle(Future.succeededFuture("abc"));
  assertEquals(Collections.singletonList("abc"), items);
  assertEquals(Collections.emptyList(), errors);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:10,代码来源:AsyncResultHandlerTest.java

示例7: testFulfillAdaptedFunctions3

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions3() {
  List<String> items = new ArrayList<>();
  List<Throwable> errors = new ArrayList<>();
  AtomicInteger completions = new AtomicInteger();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add, errors::add, completions::incrementAndGet);
  o.handle(Future.succeededFuture("abc"));
  assertEquals(Collections.singletonList("abc"), items);
  assertEquals(Collections.emptyList(), errors);
  assertEquals(1, completions.get());
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:12,代码来源:AsyncResultHandlerTest.java

示例8: testRejectAdaptedFunctions1

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions1() {
  SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext);
  Exception cause = new Exception();
  try {
    o.handle(Future.failedFuture(cause));
  } catch (OnErrorNotImplementedException e) {
    assertSame(cause, e.getCause());
  }
  subscriber.assertEmpty();
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:13,代码来源:AsyncResultHandlerTest.java

示例9: testRejectAdaptedFunctions2

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions2() {
  SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext, subscriber::onError);
  Exception cause = new Exception();
  o.handle(Future.failedFuture(cause));
  subscriber.assertError(cause).assertEmpty();
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:9,代码来源:AsyncResultHandlerTest.java

示例10: testRejectAdaptedFunctions3

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions3() {
  SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
  Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext, subscriber::onError, subscriber::onCompleted);
  Exception cause = new Exception();
  o.handle(Future.failedFuture(cause));
  subscriber.assertError(cause).assertEmpty();
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:9,代码来源:AsyncResultHandlerTest.java

示例11: toFuture

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public static <T>Handler<AsyncResult<T>> toFuture(Observer<T> observer) {
  return RxHelper.toFuture(observer);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:4,代码来源:RxGroovyMethods.java


注:本文中的io.vertx.rx.java.RxHelper.toFuture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。