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"); }
for (final Field f : ReflectionUtil.getDeclaredFields(Authenticator.class)) { if (f.getType().equals(Authenticator.class)) { ReflectionUtil.setAccessible(f);
private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) { if (targetClass.getSuperclass() != null) { processFields(visitor, targetClass.getSuperclass()); } for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) { for (Class<? extends Annotation> clz : annotationTypes) { Annotation ann = element.getAnnotation(clz); if (ann != null) { visitor.visitField(element, ann); } } } }
private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) { if (targetClass.getSuperclass() != null) { processFields(visitor, targetClass.getSuperclass()); } for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) { for (Class<? extends Annotation> clz : annotationTypes) { Annotation ann = element.getAnnotation(clz); if (ann != null) { visitor.visitField(element, ann); } } } }
private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) { if (targetClass.getSuperclass() != null) { processFields(visitor, targetClass.getSuperclass()); } for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) { for (Class<? extends Annotation> clz : annotationTypes) { Annotation ann = element.getAnnotation(clz); if (ann != null) { visitor.visitField(element, ann); } } } }
private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) { if (targetClass.getSuperclass() != null) { processFields(visitor, targetClass.getSuperclass()); } for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) { for (Class<? extends Annotation> clz : annotationTypes) { Annotation ann = element.getAnnotation(clz); if (ann != null) { visitor.visitField(element, ann); } } } }
private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) { if (targetClass.getSuperclass() != null) { processFields(visitor, targetClass.getSuperclass()); } for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) { for (Class<? extends Annotation> clz : annotationTypes) { Annotation ann = element.getAnnotation(clz); if (ann != null) { visitor.visitField(element, ann); } } } }
private void setParamField(Class<?> cls) { if (Object.class == cls || cls == null) { return; } for (Field f : ReflectionUtil.getDeclaredFields(cls)) { for (Annotation a : f.getAnnotations()) { if (AnnotationUtils.isParamAnnotationClass(a.annotationType())) { if (paramFields == null) { paramFields = new ArrayList<>(); } paramsAvailable = true; paramFields.add(f); } } } setParamField(cls.getSuperclass()); }
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"); }
private static Field getElField(String partName, final Class<?> wrapperType) { String fieldName = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.VARIABLE); Field[] fields = ReflectionUtil.getDeclaredFields(wrapperType); for (Field field : fields) { XmlElement el = field.getAnnotation(XmlElement.class); if (el != null && partName.equals(el.name())) { return field; } XmlElementRef xmlElementRefAnnotation = field.getAnnotation(XmlElementRef.class); if (xmlElementRefAnnotation != null && partName.equals(xmlElementRefAnnotation.name())) { return field; } if (field.getName().equals(fieldName)) { return field; } } return null; }
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; } }
for (final Field f : ReflectionUtil.getDeclaredFields(Authenticator.class)) { if (f.getType().equals(Authenticator.class)) { ReflectionUtil.setAccessible(f);
Field[] fields = ReflectionUtil.getDeclaredFields(cls); for (Field f : fields) { if (isFieldAccepted(f, accessType)) {