diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-11 01:46:30 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-11 01:46:30 +0000 |
commit | 8f0f2d98b1d748ff91cd33ba991d5bbce243f238 (patch) | |
tree | 486040371eb77a896a20cdeff7572053d3c1d077 /java/sca/modules/interface-java-jaxws/src | |
parent | 0eaf7caff22106935104f3c53369c11064f74662 (diff) |
Fix the code-generation against the @XmlJavaTypeAdapter
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@743192 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/interface-java-jaxws/src')
5 files changed, 112 insertions, 6 deletions
diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java index bb27781c36..6c64ad0689 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java @@ -249,9 +249,9 @@ public abstract class BaseBeanGenerator implements Opcodes { mime.visit("value", ((XmlMimeType)ann).value()); mime.visitEnd(); } else if (ann instanceof XmlJavaTypeAdapter) { - AnnotationVisitor ada = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlJavaTypeAdapter;", true); - ada.visit("value", ((XmlJavaTypeAdapter)ann).value()); - ada.visit("type", ((XmlJavaTypeAdapter)ann).type()); + AnnotationVisitor ada = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true); + ada.visit("value", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).value())); + ada.visit("type", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).type())); ada.visitEnd(); } else if (ann instanceof XmlAttachmentRef) { AnnotationVisitor att = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAttachmentRef;", true); diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java new file mode 100644 index 0000000000..67b9c84399 --- /dev/null +++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterface.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.interfacedef.java.jaxws; + +/** + * Bean Interface + */ +public interface BeanInterface { + String getAttr(); + void setAttr(String attr); +} diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java new file mode 100644 index 0000000000..f964ea374b --- /dev/null +++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BeanInterfaceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.interfacedef.java.jaxws; + +/** + * Impl of BeanInterface + */ +public class BeanInterfaceImpl implements BeanInterface { + private String attr; + + public String getAttr() { + return attr; + } + + public void setAttr(String attr) { + this.attr = attr; + } +} diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java new file mode 100644 index 0000000000..fb319a3b0f --- /dev/null +++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestAdapter.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.interfacedef.java.jaxws; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +/** + * Test XML Adapter + */ +public class TestAdapter extends XmlAdapter<BeanInterfaceImpl, BeanInterface> { + + @Override + public BeanInterfaceImpl marshal(BeanInterface v) throws Exception { + return (BeanInterfaceImpl)v; + } + + @Override + public BeanInterface unmarshal(BeanInterfaceImpl v) throws Exception { + return v; + } + +} diff --git a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java index 997713a780..1f8e6cb445 100644 --- a/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java +++ b/java/sca/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java @@ -27,6 +27,7 @@ import java.util.Map; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.ws.Holder; import org.oasisopen.sca.annotation.Remotable; @@ -60,7 +61,10 @@ public interface TestInterface { @WebMethod @WebResult(name = "output") - String webMethod(@WebParam(name = "input", mode = WebParam.Mode.IN) - String in, @WebParam(name = "holder", mode = WebParam.Mode.INOUT) - Holder<String> holder); + String webMethod(@WebParam(name = "input", mode = WebParam.Mode.IN) String in, + @WebParam(name = "holder", mode = WebParam.Mode.INOUT) Holder<String> holder); + + @XmlJavaTypeAdapter(type = BeanInterface.class, value = TestAdapter.class) + BeanInterface beanMethod(@XmlJavaTypeAdapter(type = BeanInterface.class, value = TestAdapter.class) BeanInterface in, + String str); } |