private ServiceImpl findDelegate() { for (Field f : ReflectionUtil.getDeclaredFields(Service.class)) { if (ServiceDelegate.class.equals(f.getType())) { ServiceDelegate del = ReflectionUtil.accessDeclaredField(f, this, ServiceDelegate.class); if (del instanceof ServiceImpl) { return (ServiceImpl)del; } throw new WebServiceException("Delegate of class " + del.getClass() + " is not a CXF delegate. " + " Check the classpath to make sure CXF is loaded first."); } } throw new WebServiceException("Could not find CXF service delegate"); }
protected boolean getValuesFromBeanParamField(Object bean, Field f, Class<? extends Annotation> annClass, Map<String, BeanPair> values) { boolean jaxrsParamAnnAvailable = false; Annotation fieldAnnotation = f.getAnnotation(annClass); if (fieldAnnotation != null) { jaxrsParamAnnAvailable = true; Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { String annotationValue = AnnotationUtils.getAnnotationValue(fieldAnnotation); values.put(annotationValue, new BeanPair(value, f.getAnnotations())); } } return jaxrsParamAnnAvailable; }
private ServiceImpl findDelegate() { for (Field f : ReflectionUtil.getDeclaredFields(Service.class)) { if (ServiceDelegate.class.equals(f.getType())) { ServiceDelegate del = ReflectionUtil.accessDeclaredField(f, this, ServiceDelegate.class); if (del instanceof ServiceImpl) { return (ServiceImpl)del; } throw new WebServiceException("Delegate of class " + del.getClass() + " is not a CXF delegate. " + " Check the classpath to make sure CXF is loaded first."); } } throw new WebServiceException("Could not find CXF service delegate"); }
protected boolean getValuesFromBeanParamField(Object bean, Field f, Class<? extends Annotation> annClass, Map<String, BeanPair> values) { boolean jaxrsParamAnnAvailable = false; Annotation fieldAnnotation = f.getAnnotation(annClass); if (fieldAnnotation != null) { jaxrsParamAnnAvailable = true; Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { String annotationValue = AnnotationUtils.getAnnotationValue(fieldAnnotation); values.put(annotationValue, new BeanPair(value, f.getAnnotations())); } } return jaxrsParamAnnAvailable; }
public static Response copyResponseIfNeeded(Response response) { if (!(response instanceof ResponseImpl)) { Response r = fromResponse(response).build(); Field[] declaredFields = ReflectionUtil.getDeclaredFields(response.getClass()); for (Field f : declaredFields) { Class<?> declClass = f.getType(); if (declClass == Annotation[].class) { try { Annotation[] fieldAnnotations = ReflectionUtil.accessDeclaredField(f, response, Annotation[].class); ((ResponseImpl)r).setEntityAnnotations(fieldAnnotations); } catch (Throwable ex) { LOG.warning("Custom annotations if any can not be copied"); } break; } } return r; } return response; }
public static Response copyResponseIfNeeded(Response response) { if (!(response instanceof ResponseImpl)) { Response r = fromResponse(response).build(); Field[] declaredFields = ReflectionUtil.getDeclaredFields(response.getClass()); for (Field f : declaredFields) { Class<?> declClass = f.getType(); if (declClass == Annotation[].class) { try { Annotation[] fieldAnnotations = ReflectionUtil.accessDeclaredField(f, response, Annotation[].class); ((ResponseImpl)r).setEntityAnnotations(fieldAnnotations); } catch (Throwable ex) { LOG.warning("Custom annotations if any can not be copied"); } break; } } return r; } else { return response; } }
Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { getValuesFromBeanParam(value, annClass, values); boolean jaxrsParamAnnAvailable = getValuesFromBeanParamField(bean, f, annClass, values); if (!jaxrsParamAnnAvailable && f.getAnnotation(BeanParam.class) != null) { Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { getValuesFromBeanParam(value, annClass, values);
Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { getValuesFromBeanParam(value, annClass, values); boolean jaxrsParamAnnAvailable = getValuesFromBeanParamField(bean, f, annClass, values); if (!jaxrsParamAnnAvailable && f.getAnnotation(BeanParam.class) != null) { Object value = ReflectionUtil.accessDeclaredField(f, bean, Object.class); if (value != null) { getValuesFromBeanParam(value, annClass, values);