Return-Path: Delivered-To: apmail-incubator-cxf-user-archive@locus.apache.org Received: (qmail 6052 invoked from network); 13 Mar 2008 21:28:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Mar 2008 21:28:57 -0000 Received: (qmail 62178 invoked by uid 500); 13 Mar 2008 21:28:53 -0000 Delivered-To: apmail-incubator-cxf-user-archive@incubator.apache.org Received: (qmail 62137 invoked by uid 500); 13 Mar 2008 21:28:53 -0000 Mailing-List: contact cxf-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-user@incubator.apache.org Delivered-To: mailing list cxf-user@incubator.apache.org Received: (qmail 62128 invoked by uid 99); 13 Mar 2008 21:28:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2008 14:28:53 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [64.79.199.57] (HELO server.dankulp.com) (64.79.199.57) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2008 21:28:14 +0000 Received: by server.dankulp.com (Postfix, from userid 5000) id 157D0197C23A; Thu, 13 Mar 2008 17:28:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on server.dankulp.com X-Spam-Level: X-Msg-File: /tmp/mailfilter.XXXXzusXz8 Received: from dilbert (c-24-147-10-180.hsd1.ma.comcast.net [24.147.10.180]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.dankulp.com (Postfix) with ESMTP id 7A600197C00F; Thu, 13 Mar 2008 17:28:22 -0400 (EDT) From: Daniel Kulp To: cxf-user@incubator.apache.org Subject: Re: @XmlJavaTypeAdapter with HashMap creates two fields on SOAP object Date: Thu, 13 Mar 2008 17:28:12 -0400 User-Agent: KMail/1.9.7 Cc: cwilkes References: <16038742.post@talk.nabble.com> In-Reply-To: <16038742.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803131728.13024.dkulp@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=0.3 required=3.0 tests=BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.2.4 If you read the javadoc for the XmlAccessType class, (I just did, I didn't realize this either), even private fields will be grabbed if they have a JAXB annotation on them. Thus, you might want to change to: XmlAccessType.FIELD to only look at the field. Alternatively, take the @XmlJavaTypeAdapter annotation off the field and stick it on the getter. Thus, the field won't have any jaxb annotations on it. JAXB SHOULD allow it to work that way. Dan On Thursday 13 March 2008, cwilkes wrote: > One of my WebParams has a HashMap in it and so I've annotated the > field with @XmlJavaTypeAdapter and created an XmlAdapter for it. The > java generated from the WSDL has a field that's listed in that Adapter > along with a "HashMap" that extends "AbstractMap", both in my > namespace. > > The "HashMap" object has getters and setters based on the fieldName > while the holder object for a List of my Entries is based on the > method name. That is this class: > > @XmlRootElement > public class AdRequest { > @XmlJavaTypeAdapter(QueryParametersAdapter.class) > private Map m_queryParameters; > public Map getQueryParameters() { ... } > public void setQueryParameters(Map > p_queryParameters) {} } > > Turns into this after wsdl2java: > > public class AdRequest implements java.io.Serializable { > private mynamespace.HashMap m_queryParameters; > private mynamespace.AdRequestQueryParametersEntry[] > queryParameters; } > > Where mynamespace.HashMap extends mynamespace.AbstractMap. > > Marshalling and unmarshalling works fine with my Map > values added via setQueryParameters(AdRequestQueryParametersEntry[]). > I'm just annoyed that this HashMap shows up. > > I've tried to annotate with XmlAccessType set to PUBLIC_MEMBER (the > default) and PROPERTY but it hasn't helped me out. > > If I change the field name in my original AdRequest to > "queryParameters" I get this error in my logs: > > Class has two properties of the same name "queryParameters" > this problem is related to the following location: > at public java.util.Map > com.ladro.cxf.image.AdRequest.getQueryParameters() at > com.ladro.cxf.image.AdRequest > this problem is related to the following location: > at private java.util.Map > com.ladro.cxf.image.AdRequest.queryParameters at > com.ladro.cxf.image.AdRequest > > which does make sense. > > Has anyone else seen this? I've also tried marking the field as > XmlTransient but then JAXB ignores the getters and setters. -- J. Daniel Kulp Principal Engineer, IONA dkulp@apache.org http://www.dankulp.com/blog