热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.cxf.common.util.ReflectionUtil.getDeclaredFields()方法的使用及代码示例

本文整理了Java中org.apache.cxf.common.util.ReflectionUtil.getDeclaredFields方法的一些代码示例,展示了ReflectionUtil.get

本文整理了Java中org.apache.cxf.common.util.ReflectionUtil.getDeclaredFields方法的一些代码示例,展示了ReflectionUtil.getDeclaredFields的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReflectionUtil.getDeclaredFields方法的具体详情如下:
包路径:org.apache.cxf.common.util.ReflectionUtil
类名称:ReflectionUtil
方法名:getDeclaredFields

ReflectionUtil.getDeclaredFields介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

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");
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

for (final Field f : ReflectionUtil.getDeclaredFields(Authenticator.class)) {
if (f.getType().equals(Authenticator.class)) {
ReflectionUtil.setAccessible(f);

代码示例来源:origin: apache/cxf

private void processFields(AnnotationVisitor visitor, Class targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class clz : annotationTypes) {
Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

private void processFields(AnnotationVisitor visitor, Class targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class clz : annotationTypes) {
Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
}

代码示例来源:origin: org.apache.cxf/cxf-core

private void processFields(AnnotationVisitor visitor, Class targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class clz : annotationTypes) {
Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
}

代码示例来源:origin: org.apache.cxf/cxf-api

private void processFields(AnnotationVisitor visitor, Class targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class clz : annotationTypes) {
Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

private void processFields(AnnotationVisitor visitor, Class targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class clz : annotationTypes) {
Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
}

代码示例来源:origin: apache/cxf

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());
}

代码示例来源:origin: apache/cxf

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");
}

代码示例来源:origin: apache/cxf

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;
}

代码示例来源:origin: apache/cxf

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;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

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;
}
}

代码示例来源:origin: apache/cxf

for (final Field f : ReflectionUtil.getDeclaredFields(Authenticator.class)) {
if (f.getType().equals(Authenticator.class)) {
ReflectionUtil.setAccessible(f);

代码示例来源:origin: apache/cxf

Field[] fields = ReflectionUtil.getDeclaredFields(cls);
for (Field f : fields) {
if (isFieldAccepted(f, accessType)) {

推荐阅读
author-avatar
mobiledu2502878025
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有