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


Java Subject.onNext方法代码示例

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


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

示例1: emitEvent

import rx.subjects.Subject; //导入方法依赖的package包/类
protected void emitEvent(ConfigChangeEvent<String> event)
{
    checkNotNull(event);

    final Optional<String> oldEventValue = this.lastEmittedValues.put(event.getName(), event.getValueOpt());
    if (!event.getValueOpt().equals(oldEventValue)) {
        Subject<ConfigChangeEvent<String>, ConfigChangeEvent<String>> subject = subjectMap.get(event.getName());
        if (subject == null) {
            log.warn("Event Subject was not initialized for key {} !", event.getName());
            return;
        }
        log.trace("EMIT {} - value {}", event.getName(), event.getValueOpt());
        subject.onNext(event);
    }
    else {
        log.trace("NOT EMITTING key {} value {} - no change from previous value.", event.getName(), event.getValueOpt());
    }
}
 
开发者ID:kikinteractive,项目名称:ice,代码行数:19,代码来源:AbstractDynamicConfigSource.java

示例2: testMulticast

import rx.subjects.Subject; //导入方法依赖的package包/类
@Test
public void testMulticast() {
    Subject<String, String> source = PublishSubject.create();

    ConnectableObservable<String> multicasted = new OperatorMulticast<String, String>(source, new PublishSubjectFactory());

    @SuppressWarnings("unchecked")
    Observer<String> observer = mock(Observer.class);
    multicasted.subscribe(observer);

    source.onNext("one");
    source.onNext("two");

    multicasted.connect();

    source.onNext("three");
    source.onNext("four");
    source.onComplete();

    verify(observer, never()).onNext("one");
    verify(observer, never()).onNext("two");
    verify(observer, times(1)).onNext("three");
    verify(observer, times(1)).onNext("four");
    verify(observer, times(1)).onComplete();

}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:27,代码来源:OnSubscribeMulticastTest.java

示例3: testMulticastConnectTwice

import rx.subjects.Subject; //导入方法依赖的package包/类
@Test
public void testMulticastConnectTwice() {
    Subject<String, String> source = PublishSubject.create();

    ConnectableObservable<String> multicasted = new OperatorMulticast<String, String>(source, new PublishSubjectFactory());

    @SuppressWarnings("unchecked")
    Observer<String> observer = mock(Observer.class);
    multicasted.subscribe(observer);

    source.onNext("one");

    multicasted.connect();
    multicasted.connect();

    source.onNext("two");
    source.onComplete();

    verify(observer, never()).onNext("one");
    verify(observer, times(1)).onNext("two");
    verify(observer, times(1)).onComplete();

}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:24,代码来源:OnSubscribeMulticastTest.java

示例4: testMostRecent

import rx.subjects.Subject; //导入方法依赖的package包/类
@Test
public void testMostRecent() {
    Subject<String, String> s = PublishSubject.create();

    Iterator<String> it = mostRecent(s, "default").iterator();

    assertTrue(it.hasNext());
    assertEquals("default", it.next());
    assertEquals("default", it.next());

    s.onNext("one");
    assertTrue(it.hasNext());
    assertEquals("one", it.next());
    assertEquals("one", it.next());

    s.onNext("two");
    assertTrue(it.hasNext());
    assertEquals("two", it.next());
    assertEquals("two", it.next());

    s.onComplete();
    assertFalse(it.hasNext());

}
 
开发者ID:akarnokd,项目名称:RxJavaFlow,代码行数:25,代码来源:BlockingOperatorMostRecentTest.java

示例5: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 *
 * @param content
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public void post(@NonNull Object tag, @NonNull Object content) {
    LogUtil.d("post", "eventName: " + tag);
    List<Subject> subjectList = subjectMapper.get(tag);
    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
            LogUtil.d("onEvent", "eventName: " + tag);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:RxBus.java

示例6: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 *
 * @param content
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public void post(@NonNull Object tag, @NonNull Object content) {
    LogUtils.logd("post"+ "eventName: " + tag);
    List<Subject> subjectList = subjectMapper.get(tag);
    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
            LogUtils.logd("onEvent"+ "eventName: " + tag);
        }
    }
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:17,代码来源:RxBus.java

示例7: sendMessageByRx

import rx.subjects.Subject; //导入方法依赖的package包/类
public void sendMessageByRx(LeResponseMessage responseMessage) {
    if (responseMessage != null) {
        List<Subject> subjectList = (List) this.subjectMapper.get(responseMessage.getId());
        if (subjectList != null && !subjectList.isEmpty()) {
            for (Subject subject : subjectList) {
                subject.onNext(responseMessage);
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:LeMessageManager.java

示例8: onFavCheckBoxTapped

import rx.subjects.Subject; //导入方法依赖的package包/类
public void onFavCheckBoxTapped(View view) {
    if (!(view instanceof CheckBox)) {
        Log.w(TAG, "onFavCheckBoxTapped: view is not CheckBox: " + view);
        return;
    }
    boolean isChecked = ((CheckBox) view).isChecked();
    Subject<FavEvent, FavEvent> favEventSubject = ((MainApplication) view.getContext().getApplicationContext()).getFavEventSubject();
    favEventSubject.onNext(new FavEvent(this.qiitaItemid, isChecked));
}
 
开发者ID:sumio,项目名称:espresso-sample-for-droidkaigi2017,代码行数:10,代码来源:FavableQiitaItem.java

示例9: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public void post(@NonNull Object tag, @NonNull Object content) {
  LogUtils.d("post" + "eventName: " + tag);
  List<Subject> subjectList = subjectMapper.get(tag);
  if (!isEmpty(subjectList)) {
    for (Subject subject : subjectList) {
      subject.onNext(content);
      LogUtils.d("eventName: " + tag);
    }
  }
}
 
开发者ID:MixAndroid,项目名称:MixUtils,代码行数:15,代码来源:RxBus.java

示例10: post

import rx.subjects.Subject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void post(@NonNull Object tag, @NonNull Object content) {
    List<Subject> subjectList = subjectMapper.get(tag);

    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
        }
    }
    if (DEBUG) Log.d(TAG, "[send]subjectMapper: " + subjectMapper);
}
 
开发者ID:zyj1609wz,项目名称:RxJava_RxAndroid,代码行数:12,代码来源:RxBus.java

示例11: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 *
 * @param content
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public void post(@NonNull Object tag, @NonNull Object content) {
    List<Subject> subjectList = subjectMapper.get(tag);
    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
        }
    }
}
 
开发者ID:43081438,项目名称:RxJavaAndRetrofitSimple,代码行数:15,代码来源:StandardRxBus.java

示例12: post

import rx.subjects.Subject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void post(@NonNull Object tag, @NonNull Object content) {
    List<Subject> subjectList = subjectMapper.get(tag);

    if (!(subjectList==null||subjectList.isEmpty())) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
        }
    }
    if (DEBUG) Log.d(TAG, "[send]subjectMapper: " + subjectMapper);
}
 
开发者ID:43081438,项目名称:RxJavaAndRetrofitSimple,代码行数:12,代码来源:RxBus.java

示例13: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 */
@SuppressWarnings({"unchecked", "rawtypes"})
public void post(@NonNull Object tag, @NonNull Object content) {
    LogUtils.logd("post" + "eventName: " + tag);
    List<Subject> subjectList = subjectMapper.get(tag);
    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
            LogUtils.logd("onEvent" + "eventName: " + tag);
        }
    }
}
 
开发者ID:RockTeach,项目名称:VMovie,代码行数:15,代码来源:RxBus.java

示例14: post

import rx.subjects.Subject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void post(@NonNull Object tag, @NonNull Object content) {
    List<Subject> subjects = subjectMapper.get(tag);
    if(null != subjects && subjects.size() > 0) {
        for(Subject subject : subjects) {
            subject.onNext(content);
        }
    }
}
 
开发者ID:DreamJM,项目名称:AndroidGenerator,代码行数:10,代码来源:RxBus.java

示例15: post

import rx.subjects.Subject; //导入方法依赖的package包/类
/**
 * 触发事件
 *
 * @param content
 */
public void post(@NonNull Object tag, @NonNull Object content) {
    List<Subject> subjectList = subjectMapper.get(tag);
    if (!isEmpty(subjectList)) {
        for (Subject subject : subjectList) {
            subject.onNext(content);
        }
    }
}
 
开发者ID:bodismile,项目名称:smile-mvp,代码行数:14,代码来源:RxBus.java


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