本文整理了Java中org.crsh.util.Utils.resolveToClass()
方法的一些代码示例,展示了Utils.resolveToClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.resolveToClass()
方法的具体详情如下:
包路径:org.crsh.util.Utils
类名称:Utils
方法名:resolveToClass
暂无
代码示例来源:origin: crashub/crash
protected CRaSHPlugin() {
this.type = (Class<P>)Utils.resolveToClass(getClass(), CRaSHPlugin.class, 0);
this.status = CONSTRUCTED;
this.context = null;
}
代码示例来源:origin: crashub/crash
public final Class<C> getConsumedType() {
return (Class<C>)Utils.resolveToClass(getClass(), Pipe.class, 0);
}
代码示例来源:origin: crashub/crash
public final Class<P> getProducedType() {
return (Class<P>)Utils.resolveToClass(getClass(), Pipe.class, 1);
}
代码示例来源:origin: crashub/crash
public static Class resolveToClass(Type type) {
if (type == null) {
throw new NullPointerException("No null type accepted");
}
if (type instanceof Class<?>) {
return (Class<?>)type;
} else if (type instanceof TypeVariable) {
TypeVariable resolvedTypeVariable = (TypeVariable)type;
return resolveToClass(resolvedTypeVariable.getBounds()[0]);
} else {
throw new UnsupportedOperationException("Type resolution of " + type + " not yet implemented");
}
}
代码示例来源: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
public PipeCommandMatch(ClassShellCommand<T> baseShellCommand, CommandInvoker<Instance<T>, PC> invoker) {
super(baseShellCommand);
this.invoker = invoker;
ret = invoker.getGenericReturnType();
consumedType = (Class<C>)Utils.resolveToClass(ret, Pipe.class, 0);
producedType = (Class<P>)Utils.resolveToClass(ret, Pipe.class, 1);
name = baseShellCommand.getDescriptor().getName();
}
代码示例来源: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
if (InvocationContext.class.isAssignableFrom(parameterType)) {
Type contextGenericParameterType = objectInvoker.getGenericParameterTypes()[i];
producedType = Utils.resolveToClass(contextGenericParameterType, InvocationContext.class, 0);
break;
代码示例来源: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: 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: 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: com.github.corda.crash/crash.shell
protected CRaSHPlugin() {
this.type = (Class<P>)Utils.resolveToClass(getClass(), CRaSHPlugin.class, 0);
this.status = CONSTRUCTED;
this.context = null;
}
代码示例来源:origin: org.crashub/crash.shell
protected CRaSHPlugin() {
this.type = (Class<P>)Utils.resolveToClass(getClass(), CRaSHPlugin.class, 0);
this.status = CONSTRUCTED;
this.context = null;
}
代码示例来源:origin: org.crashub/crash.shell
public final Class<C> getConsumedType() {
return (Class<C>)Utils.resolveToClass(getClass(), Pipe.class, 0);
}
代码示例来源:origin: org.crashub/crash.shell
public static Class resolveToClass(Type type) {
if (type == null) {
throw new NullPointerException("No null type accepted");
}
if (type instanceof Class<?>) {
return (Class<?>)type;
} else if (type instanceof TypeVariable) {
TypeVariable resolvedTypeVariable = (TypeVariable)type;
return resolveToClass(resolvedTypeVariable.getBounds()[0]);
} else {
throw new UnsupportedOperationException("Type resolution of " + type + " not yet implemented");
}
}
代码示例来源: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;
}
}
代码示例来源:origin: com.github.corda.crash/crash.shell
public PipeCommandMatch(ClassShellCommand<T> baseShellCommand, CommandInvoker<Instance<T>, PC> invoker) {
super(baseShellCommand);
this.invoker = invoker;
ret = invoker.getGenericReturnType();
consumedType = (Class<C>)Utils.resolveToClass(ret, Pipe.class, 0);
producedType = (Class<P>)Utils.resolveToClass(ret, Pipe.class, 1);
name = baseShellCommand.getDescriptor().getName();
}
代码示例来源:origin: org.crashub/crash.shell
public PipeCommandMatch(ClassShellCommand<T> baseShellCommand, CommandInvoker<Instance<T>, PC> invoker) {
super(baseShellCommand);
this.invoker = invoker;
ret = invoker.getGenericReturnType();
consumedType = (Class<C>)Utils.resolveToClass(ret, Pipe.class, 0);
producedType = (Class<P>)Utils.resolveToClass(ret, Pipe.class, 1);
name = baseShellCommand.getDescriptor().getName();
}
内容来源于网络,如有侵权,请联系作者删除!