Author: mmusaji
Date: 2013-01-21 06:53:27 -0500 (Mon, 21 Jan 2013)
New Revision: 17240
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
Log:
[JBPAPP-10458] Ensure @XMLJavaTypeAdapter is picked up at package-info level
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java 2013-01-18
04:30:36 UTC (rev 17239)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/WrapperClassGenerator.java 2013-01-21
11:53:27 UTC (rev 17240)
@@ -38,6 +38,7 @@
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
import javax.xml.namespace.QName;
import javax.xml.ws.Holder;
@@ -262,11 +263,47 @@
getClassCode(XmlNsForm.class),
q ? "QUALIFIED" : "UNQUALIFIED");
av0.visitEnd();
+
+ if (clz.getPackage() != null && clz.getPackage().getAnnotations() !=
null) {
+ for (Annotation ann : clz.getPackage().getAnnotations()) {
+ if (ann instanceof XmlJavaTypeAdapters) {
+ av0 =
cw.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapters;",
+ true);
+ generateXmlJavaTypeAdapters(av0, (XmlJavaTypeAdapters)ann);
+ av0.visitEnd();
+ } else if (ann instanceof XmlJavaTypeAdapter) {
+ av0 =
cw.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;",
+ true);
+ generateXmlJavaTypeAdapter(av0, (XmlJavaTypeAdapter)ann);
+ av0.visitEnd();
+ }
+ }
+ }
cw.visitEnd();
-
+
loadClass(className, clz, cw.toByteArray());
}
+ private void generateXmlJavaTypeAdapters(AnnotationVisitor av, XmlJavaTypeAdapters
adapters) {
+ AnnotationVisitor av1 = av.visitArray("value");
+
+ for (XmlJavaTypeAdapter adapter : adapters.value()) {
+ AnnotationVisitor av2
+ = av1.visitAnnotation(null,
"Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;");
+ generateXmlJavaTypeAdapter(av2, adapter);
+ av2.visitEnd();
+ }
+ av1.visitEnd();
+ }
+ private void generateXmlJavaTypeAdapter(AnnotationVisitor av, XmlJavaTypeAdapter
adapter) {
+ if (adapter.value() != null) {
+ av.visit("value",
org.objectweb.asm.Type.getType(getClassCode(adapter.value())));
+ }
+ if (adapter.type() !=
javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT.class) {
+ av.visit("type",
org.objectweb.asm.Type.getType(getClassCode(adapter.type())));
+ }
+ }
+
private void generateMessagePart(ClassWriter cw, MessagePartInfo mpi, Method method,
String className) {
if (Boolean.TRUE.equals(mpi.getProperty(ReflectionServiceFactoryBean.HEADER))) {
return;
@@ -373,13 +410,7 @@
av0.visitEnd();
} else if (ann instanceof XmlJavaTypeAdapter) {
av0 =
fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;",
true);
- XmlJavaTypeAdapter adapter = (XmlJavaTypeAdapter)ann;
- if (adapter.value() != null) {
- av0.visit("value",
org.objectweb.asm.Type.getType(getClassCode(adapter.value())));
- }
- if (adapter.type() !=
javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT.class) {
- av0.visit("type",
org.objectweb.asm.Type.getType(getClassCode(adapter.type())));
- }
+ generateXmlJavaTypeAdapter(av0, (XmlJavaTypeAdapter)ann);
av0.visitEnd();
} else if (ann instanceof XmlAttachmentRef) {
av0 =
fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAttachmentRef;", true);
Show replies by date