本文整理了Java中java.lang.reflect.Executable.getAnnotatedParameterTypes()
方法的一些代码示例,展示了Executable.getAnnotatedParameterTypes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executable.getAnnotatedParameterTypes()
方法的具体详情如下:
包路径:java.lang.reflect.Executable
类名称:Executable
方法名:getAnnotatedParameterTypes
暂无
代码示例来源:origin: stackoverflow.com
for (AnnotatedType t : method.getAnnotatedParameterTypes()) {
annotation = t.getAnnotation(MyTypeAnnotation.class);
if (annotation != null) {
代码示例来源:origin: com.oracle.substratevm/library-support
@Override
public Object compute(MetaAccessProvider metaAccess, ResolvedJavaField original, ResolvedJavaField annotated, Object receiver) {
Executable executable = (Executable) receiver;
return executable.getAnnotatedParameterTypes();
}
}
代码示例来源:origin: stackoverflow.com
public class AnnoTest {
@Retention(RetentionPolicy.RUNTIME)
@interface Email {}
void example(@Email String arg) {}
public static void main(String[] args) throws ReflectiveOperationException {
Method method=AnnoTest.class.getDeclaredMethod("example", String.class);
System.out.println("parameter type annotations:");
AnnotatedType annotatedType = method.getAnnotatedParameterTypes()[0];
//Annotation annotation = annotatedType.getAnnotation(Annotation.class);
System.out.println(Arrays.toString(annotatedType.getAnnotations()));
System.out.println("parameter annotations:");
System.out.println(Arrays.toString(method.getParameterAnnotations()[0]));
}
}
代码示例来源:origin: stackoverflow.com
public class AnnoTest {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE_USE)
@interface Email {}
void example(@Email String arg) {}
public static void main(String[] args) throws ReflectiveOperationException {
Method method=AnnoTest.class.getDeclaredMethod("example", String.class);
System.out.println("parameter type annotations:");
AnnotatedType annotatedType = method.getAnnotatedParameterTypes()[0];
//Annotation annotation = annotatedType.getAnnotation(Annotation.class);
System.out.println(Arrays.toString(annotatedType.getAnnotations()));
System.out.println("parameter annotations:");
System.out.println(Arrays.toString(method.getParameterAnnotations()[0]));
}
}
代码示例来源:origin: stackoverflow.com
System.out.println(returnTypeAnnotation);
AnnotatedType[] parameters = m.getAnnotatedParameterTypes();
for (AnnotatedType p : parameters) {
Annotation parameterAnnotation = p.getAnnotation(ExpectedType.class);
代码示例来源:origin: io.leangen.geantyref/geantyref
private static AnnotatedType[] getParameterTypes(Executable exe, AnnotatedType declaringType, VarMap.MappingMode mappingMode) {
AnnotatedType[] parameterTypes = exe.getAnnotatedParameterTypes();
AnnotatedType exactDeclaringType = getExactSuperType(capture(declaringType), exe.getDeclaringClass());
if (exactDeclaringType == null) { // capture(type) is not a subtype of exe.getDeclaringClass()
throw new IllegalArgumentException("The method/constructor " + exe + " is not a member of type " + declaringType);
}
AnnotatedType[] result = new AnnotatedType[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
result[i] = mapTypeParameters(parameterTypes[i], exactDeclaringType, mappingMode);
}
return result;
}
代码示例来源:origin: leangen/graphql-spqr
/**
* Returns the exact annotated parameter types of the executable declared by the given type, with type variables resolved (if possible)
*
* @param executable The executable whose parameter types are to be resolved
* @param declaringType The declaring annotated type against which to resolve the types of the parameters of the given executable
* @return The resolved annotated types of the parameters of the given executable
*/
public static AnnotatedType[] getParameterTypes(Executable executable, AnnotatedType declaringType) {
AnnotatedType exactDeclaringType = GenericTypeReflector.getExactSuperType(capture(declaringType), executable.getDeclaringClass());
if (isMissingTypeParameters(exactDeclaringType.getType())) {
return executable.getAnnotatedParameterTypes();
}
return GenericTypeReflector.getParameterTypes(executable, declaringType);
}
内容来源于网络,如有侵权,请联系作者删除!