當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。