java.lang.Object.getClass()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(264)

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

Object.getClass介绍

暂无

代码示例

代码示例来源:origin: ReactiveX/RxJava

/**
 * Appends the class name to a non-null value.
 * @param o the object
 * @return the string representation
 */
public static String valueAndClass(Object o) {
  if (o != null) {
    return o + " (class: " + o.getClass().getSimpleName() + ")";
  }
  return "null";
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public String toString() {
    return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(Subscription s) {
  if (EndConsumerHelper.setOnce(this.upstream, s, getClass())) {
    long r = missedRequested.getAndSet(0L);
    if (r != 0L) {
      s.request(r);
    }
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(Subscription s) {
  if (EndConsumerHelper.validate(this.upstream, s, getClass())) {
    this.upstream = s;
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.validate(this.upstream, d, getClass())) {
    this.upstream = d;
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public final void onSubscribe(@NonNull Disposable d) {
  if (EndConsumerHelper.setOnce(this.upstream, d, getClass())) {
    onStart();
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void just() {
  Flowable<Integer> source = Flowable.fromArray(new Integer[] { 1 });
  Assert.assertTrue(source.getClass().toString(), source instanceof ScalarCallable);
}

代码示例来源:origin: ReactiveX/RxJava

@SuppressWarnings("unchecked")
  @Test
  public void scalarCallable() {
    Maybe<Integer> m = Maybe.just(1);

    assertTrue(m.getClass().toString(), m instanceof ScalarCallable);

    assertEquals(1, ((ScalarCallable<Integer>)m).call().intValue());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
  public void scalarCallable() {
    Maybe<Integer> m = Maybe.empty();

    assertTrue(m.getClass().toString(), m instanceof ScalarCallable);

    assertNull(((ScalarCallable<?>)m).call());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
  public void validateSubscription() {
    BooleanSubscription bs1 = new BooleanSubscription();

    assertFalse(EndConsumerHelper.validate(SubscriptionHelper.CANCELLED, bs1, getClass()));

    assertTrue(bs1.isCancelled());

    assertTrue(errors.toString(), errors.isEmpty());
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void validateDisposable() {
  Disposable d1 = Disposables.empty();
  assertFalse(EndConsumerHelper.validate(DisposableHelper.DISPOSED, d1, getClass()));
  assertTrue(d1.isDisposed());
  assertTrue(errors.toString(), errors.isEmpty());
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void source() {
  Maybe<Integer> m = Maybe.just(1);
  Single<Integer> s = m.toSingle();
  assertTrue(s.getClass().toString(), s instanceof HasUpstreamMaybeSource);
  assertSame(m, (((HasUpstreamMaybeSource<?>)s).source()));
}

相关文章