You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by hohteri <ha...@tecnomen.com> on 2008/02/09 13:21:05 UTC

Simple Aegis mapping issue

I have an interface where I have defined:


    @XmlElement(minOccurs = "0", nillable = false)
    List<Locale> getLocales();

   @XmlElement(minOccurs = "1", nillable = false)
    List<String> getNames();


I have written own data type mapper for Locale to map it into a single
string (e.g. de_DE).

Everything works as expected but the traffic looks like this:

<ns1:locales>
  <ns1:string>de_DE</ns1:string>
  <ns1:string>en_US</ns1:string>
</ns1:locales>

<ns1:names>
  <ns1:string>Harri</ns1:string>
  <ns1:string>Hohteri</ns1:string>
</ns1:names>

While I would like to have it look like:

<ns1:locales>
  <ns1:locale>de_DE</ns1:locale>
  <ns1:locale>en_US</ns1:locale>
</ns1:locales>

<ns1:names>
  <ns1:name>Harri</ns1:name>
  <ns1:name>Hohteri</ns1:name>
</ns1:names>

I assume there is something missing in my locale data type but for the
latter, I have no clue how to fix this issue other than wrapping the string
into a class named Name, which I would not like to do.

Looking through the code it seems that the default name is got in ArrayType
line 284 (CXF 2.0.3):
element.setAttribute(new Attribute("name",
componentType.getSchemaType().getLocalPart()));

The componentType is a reference to the type mapping of the class wrapped by
the array (or collection) unless the componentName is set when it would be
the type mapping indicated by this name.

I assume I would like to set the componentName for the names case or use a
specific mapping only for this case. But how to do that?

Harri
-- 
View this message in context: http://www.nabble.com/Simple-Aegis-mapping-issue-tp15371152p15371152.html
Sent from the cxf-user mailing list archive at Nabble.com.