本文整理了Java中org.crsh.util.Utils.resolve()
方法的一些代码示例,展示了Utils.resolve()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.resolve()
方法的具体详情如下:
包路径:org.crsh.util.Utils
类名称:Utils
方法名:resolve
[英]A simplistic implementation, it may not handle all cases but it should handle enough.
[中]这是一个过于简单的实现,它可能不能处理所有情况,但它应该处理足够多的情况。
代码示例来源:origin: crashub/crash
public static Class<?> resolveToClass(Type implementation, Class<?> type, int parameterIndex) {
if (implementation == null) {
throw new NullPointerException("No null type accepted");
}
// First resolve to type
Type resolvedType = resolve(implementation, type, parameterIndex);
//
if (resolvedType != null) {
return resolveToClass(resolvedType);
} else {
return null;
}
}
代码示例来源:origin: crashub/crash
Type resolved = null;
if (gsc != null) {
resolved = resolve(gsc, type, parameterIndex);
if (resolved == null) {
} else if (rawType instanceof Class<?>) {
Class<?> classRawType = (Class<?>)rawType;
Type resolved = resolve(classRawType, type, parameterIndex);
if (resolved == null) {
return null;
for (int i = 0;i < a.length;i++) {
if (a[i].equals(resolvedTV)) {
return resolve(implementation, classRawType, i);
代码示例来源:origin: crashub/crash
public void testBar() {
class A extends ThreadLocal<String> {}
Type resolved = Utils.resolve(A.class, ThreadLocal.class, 0);
assertEquals(String.class, resolved);
assertEquals(String.class, Utils.resolveToClass(A.class, ThreadLocal.class, 0));
}
代码示例来源:origin: com.github.corda.crash/crash.shell
Type resolved = null;
if (gsc != null) {
resolved = resolve(gsc, type, parameterIndex);
if (resolved == null) {
} else if (rawType instanceof Class<?>) {
Class<?> classRawType = (Class<?>)rawType;
Type resolved = resolve(classRawType, type, parameterIndex);
if (resolved == null) {
return null;
for (int i = 0;i < a.length;i++) {
if (a[i].equals(resolvedTV)) {
return resolve(implementation, classRawType, i);
代码示例来源:origin: crashub/crash
public void testJuu() {
class A extends InheritableThreadLocal<String> {}
Type resolved = Utils.resolve(A.class, ThreadLocal.class, 0);
assertEquals(String.class, resolved);
assertEquals(String.class, Utils.resolveToClass(A.class, ThreadLocal.class, 0));
}
代码示例来源:origin: org.crashub/crash.shell
Type resolved = null;
if (gsc != null) {
resolved = resolve(gsc, type, parameterIndex);
if (resolved == null) {
} else if (rawType instanceof Class<?>) {
Class<?> classRawType = (Class<?>)rawType;
Type resolved = resolve(classRawType, type, parameterIndex);
if (resolved == null) {
return null;
for (int i = 0;i < a.length;i++) {
if (a[i].equals(resolvedTV)) {
return resolve(implementation, classRawType, i);
代码示例来源:origin: crashub/crash
public void testZoo() {
class A extends ThreadLocal {}
TypeVariable resolved = (TypeVariable)Utils.resolve(A.class, ThreadLocal.class, 0);
assertEquals("T", resolved.getName());
assertEquals(Collections.<Type>singletonList(Object.class), Arrays.asList(resolved.getBounds()));
assertEquals(Object.class, Utils.resolveToClass(A.class, ThreadLocal.class, 0));
}
代码示例来源:origin: crashub/crash
public void testDaa() {
Type resolved = Utils.resolve(InheritableThreadLocal.class, ThreadLocal.class, 0);
assertTrue(resolved instanceof TypeVariable);
TypeVariable tv = (TypeVariable)resolved;
assertEquals(InheritableThreadLocal.class, tv.getGenericDeclaration());
assertEquals(Object.class, Utils.resolveToClass(InheritableThreadLocal.class, ThreadLocal.class, 0));
}
代码示例来源:origin: crashub/crash
public void testFoo() {
Type resolved = Utils.resolve(ThreadLocal.class, ThreadLocal.class, 0);
assertTrue(resolved instanceof TypeVariable);
TypeVariable tv = (TypeVariable)resolved;
assertEquals(ThreadLocal.class, tv.getGenericDeclaration());
assertEquals(Object.class, Utils.resolveToClass(ThreadLocal.class, ThreadLocal.class, 0));
}
代码示例来源:origin: org.crashub/crash.shell
public static Class<?> resolveToClass(Type implementation, Class<?> type, int parameterIndex) {
if (implementation == null) {
throw new NullPointerException("No null type accepted");
}
// First resolve to type
Type resolvedType = resolve(implementation, type, parameterIndex);
//
if (resolvedType != null) {
return resolveToClass(resolvedType);
} else {
return null;
}
}
代码示例来源:origin: com.github.corda.crash/crash.shell
public static Class<?> resolveToClass(Type implementation, Class<?> type, int parameterIndex) {
if (implementation == null) {
throw new NullPointerException("No null type accepted");
}
// First resolve to type
Type resolvedType = resolve(implementation, type, parameterIndex);
//
if (resolvedType != null) {
return resolveToClass(resolvedType);
} else {
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!