本文整理了Java中java.lang.Class.getSimpleName()
方法的一些代码示例,展示了Class.getSimpleName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Class.getSimpleName()
方法的具体详情如下:
包路径:java.lang.Class
类名称:Class
方法名:getSimpleName
[英]Returns the simple name of the class represented by this Class as defined in the source code. If there is no name (that is, the class is anonymous) then an empty string is returned. If the receiver is an array then the name of the underlying type with square braces appended (for example "Integer[]") is returned.
[中]返回源代码中定义的由此类表示的类的简单名称。如果没有名称(即,该类是匿名的),则返回一个空字符串。如果接收器是数组,则返回附加了方括号的基础类型的名称(例如“Integer[])。
代码示例来源: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: square/retrofit
static RuntimeException methodError(Method method, @Nullable Throwable cause, String message,
Object... args) {
message = String.format(message, args);
return new IllegalArgumentException(message
+ "\n for method "
+ method.getDeclaringClass().getSimpleName()
+ "."
+ method.getName(), cause);
}
代码示例来源: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 String toString() {
return String.format("%s{%s}", getClass().getSimpleName(), super.toString());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(MaybeEmitter<Object> emitter) throws Exception {
assertTrue(emitter.toString().contains(MaybeCreate.Emitter.class.getSimpleName()));
}
}).test().assertEmpty();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(CompletableEmitter emitter) throws Exception {
assertTrue(emitter.toString().contains(CompletableCreate.Emitter.class.getSimpleName()));
}
}).test().assertEmpty();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(SingleEmitter<Object> emitter) throws Exception {
assertTrue(emitter.toString().contains(SingleCreate.Emitter.class.getSimpleName()));
}
}).test().assertEmpty();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(FlowableEmitter<Object> emitter) throws Exception {
assertTrue(emitter.toString().contains(entry.getValue().getSimpleName()));
assertTrue(emitter.serialize().toString().contains(entry.getValue().getSimpleName()));
}
}, entry.getKey()).test().assertEmpty();
代码示例来源:origin: ReactiveX/RxJava
@Override
public void subscribe(ObservableEmitter<Object> emitter) throws Exception {
assertTrue(emitter.toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName()));
assertTrue(emitter.serialize().toString().contains(ObservableCreate.CreateEmitter.class.getSimpleName()));
}
}).test().assertEmpty();
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkMaybeSchedulerDoc() throws Exception {
checkSchedulerBadMethod(Maybe.class.getSimpleName());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkMaybeBackpressure() throws Exception {
checkSource(Maybe.class.getSimpleName(), false);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkSingleSchedulerDoc() throws Exception {
checkSchedulerBadMethod(Single.class.getSimpleName());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkObservableBackpressure() throws Exception {
checkSource(Observable.class.getSimpleName(), false);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkObservableSchedulerDoc() throws Exception {
checkSchedulerBadMethod(Observable.class.getSimpleName());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkFlowableBackpressure() throws Exception {
checkSource(Flowable.class.getSimpleName(), false);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkSingleScheduler() throws Exception {
checkSource(Single.class.getSimpleName(), true);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkMaybeScheduler() throws Exception {
checkSource(Maybe.class.getSimpleName(), true);
}
内容来源于网络,如有侵权,请联系作者删除!