/** * Get an annotation * * @param constructor the constructor * @param annotationClass the annotation class * @return the annotation */ public static Annotation getAnnotation(Constructor constructor, Class annotationClass) { if (annotationClass == null) throw new NullPointerException("Null annotation"); String searchName = annotationClass.getName(); for (Object annotation : getAnnotationsInternal(constructor)) { AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(annotation); if (searchName.equals(impl.getTypeName())) return (Annotation)annotation; } return null; }
/** * Get an annotation * * @param method the method * @param annotationClass the annotation class * @return the annotation */ public static Annotation getAnnotation(Method method, Class annotationClass) { if (annotationClass == null) throw new NullPointerException("Null annotation"); String searchName = annotationClass.getName(); for (Object annotation : getAnnotationsInternal(method)) { AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(annotation); if (searchName.equals(impl.getTypeName())) return (Annotation)annotation; } return null; }
private String tryExtractFromParamTypeAnnotation(Object[] annotations) { for (Object o : annotations) { AnnotationImpl annotation = (AnnotationImpl) Proxy.getInvocationHandler(o); if (annotation.getTypeName().equals(ParamType.class.getName())) { String value = ((StringMemberValue) annotation.getAnnotation().getMemberValue("value")).getValue(); return value.equals("") ? null : value; } } return null; } }
/** * Get an annotation * * @param clazz the class * @param annotationClass the annotation class * @return the annotation */ public static Annotation getAnnotation(Class clazz, Class annotationClass) { if (annotationClass == null) throw new NullPointerException("Null annotation"); String searchName = annotationClass.getName(); for (Object annotation : getAnnotationsInternal(clazz)) { AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(annotation); if (searchName.equals(impl.getTypeName())) return (Annotation)annotation; } return null; }
/** * Get an annotation * * @param field the field * @param annotationClass the annotation class * @return the annotation */ public static Annotation getAnnotation(Field field, Class annotationClass) { if (annotationClass == null) throw new NullPointerException("Null annotation"); String searchName = annotationClass.getName(); for (Object annotation : getAnnotationsInternal(field)) { AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(annotation); if (searchName.equals(impl.getTypeName())) return (Annotation)annotation; } return null; }
private String tryExtractFromParamTypeAnnotation(Object[] annotations) { for (Object o : annotations) { AnnotationImpl annotation = (AnnotationImpl) Proxy.getInvocationHandler(o); if (annotation.getTypeName().equals(ParamType.class.getName())) { String value = ((StringMemberValue) annotation.getAnnotation().getMemberValue("value")).getValue(); return value.equals("") ? null : value; } } return null; } }
private String getRemoveServiceRelativePath(Class<?> clazz) { CtClass ctClass = GwtClassPool.getCtClass((clazz)); Object[] annotations = ctClass.getAvailableAnnotations(); for (Object o : annotations) { if (Proxy.isProxyClass(o.getClass())) { AnnotationImpl annotation = (AnnotationImpl) Proxy.getInvocationHandler(o); if (annotation.getTypeName().equals(RemoteServiceRelativePath.class.getName())) { return ((StringMemberValue) annotation.getAnnotation().getMemberValue("value")).getValue(); } } } throw new GwtTestRpcException("Cannot find the '@" + RemoteServiceRelativePath.class.getSimpleName() + "' annotation on RemoteService interface '" + clazz.getName() + "'"); }
private String getRemoveServiceRelativePath(Class<?> clazz) { CtClass ctClass = GwtClassPool.getCtClass((clazz)); Object[] annotations = ctClass.getAvailableAnnotations(); for (Object o : annotations) { if (Proxy.isProxyClass(o.getClass())) { AnnotationImpl annotation = (AnnotationImpl) Proxy.getInvocationHandler(o); if (annotation.getTypeName().equals(RemoteServiceRelativePath.class.getName())) { return ((StringMemberValue) annotation.getAnnotation().getMemberValue("value")).getValue(); } } } throw new GwtTestRpcException("Cannot find the '@" + RemoteServiceRelativePath.class.getSimpleName() + "' annotation on RemoteService interface '" + clazz.getName() + "'"); }