public static Annotation unwrapAnnotation(Object annotation) { AnnotationImpl annotationImpl = (AnnotationImpl) Proxy.getInvocationHandler(annotation); return annotationImpl.getAnnotation(); }
@SuppressWarnings("unchecked") public static <T extends Annotation> javassist.bytecode.annotation.Annotation getAnnotation( CtClass ctClass, Class<T> annotationClass) throws ClassNotFoundException { T proxiedAnnot = (T) ctClass.getAnnotation(annotationClass); if (proxiedAnnot == null) { return null; } else if (!Proxy.isProxyClass(proxiedAnnot.getClass())) { return null; } AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(proxiedAnnot); return impl.getAnnotation(); }
@SuppressWarnings("unchecked") public static <T extends Annotation> javassist.bytecode.annotation.Annotation getAnnotation( CtClass ctClass, Class<T> annotationClass) throws ClassNotFoundException { T proxiedAnnot = (T) ctClass.getAnnotation(annotationClass); if (proxiedAnnot == null) { return null; } else if (!Proxy.isProxyClass(proxiedAnnot.getClass())) { return null; } AnnotationImpl impl = (AnnotationImpl) Proxy.getInvocationHandler(proxiedAnnot); return impl.getAnnotation(); }
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 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() + "'"); }