作者:mobiledu2502878025 | 来源:互联网 | 2023-06-17 17:52
本文整理了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 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);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-common-utilities
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);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-core
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);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-api
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);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
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);
}
}
}
}
代码示例来源: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)) {