rx.Observable.asObservable()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中rx.Observable.asObservable()方法的一些代码示例,展示了Observable.asObservable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.asObservable()方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:asObservable

Observable.asObservable介绍

[英]Disguises a object of an Observable subclass as a simple Observable object. Useful for instance when you have an implementation of a subclass of Observable but you want to hide the properties and methods of this subclass from whomever you are passing the Observable to. Scheduler: asObservable does not operate by default on a particular Scheduler.
[中]将可观测子类的对象伪装为简单的可观测对象。例如,当你有一个Observable子类的实现,但你想对你传递Observable给的人隐藏这个子类的属性和方法时,这很有用。调度器:默认情况下,asObservable不会在特定的调度器上运行。

代码示例

代码示例来源:origin: com.github.davidmoten/order-tracker

public Observable<String> events() {
  return subject.serialize().asObservable();
}

代码示例来源:origin: hantsy/spring-reactive-sample

Observable<Post> findAll() {
  return this.db.select("select * from posts")
    .get(
      rs -> new Post(rs.getLong("id"),
        rs.getString("title"),
        rs.getString("content")
      )
    )
    .asObservable();
}

代码示例来源:origin: com.netflix.eureka/eureka2-core

lifecycle.asObservable(),
initSubject.asObservable(),
new Action0() {  // Why not perform this shutdown on an unsubscribe on the lifecycle?

相关文章

Observable类方法