users@jaxb.java.net

Re: Edit Schema type on input parameter

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 29 Nov 2011 19:53:07 +0100

Setter arguments are of the property type.

If doSomething() isn't a setter you hold bad cards.

-W


On 29 November 2011 19:43, Jeremy Robertson <jeremychocolate_at_gmail.com> wrote:
> The problem is that the snippet below shows day as a field or property. I
> need it to be an input parameter:
> protected doSomething(@XmlSchemaType(name="date") Date day);
>
> Jeremy
>
> On Tue, Nov 29, 2011 at 10:43 AM, Wolfgang Laun <wolfgang.laun_at_gmail.com>
> wrote:
>>
>> Going from the XML schema entry
>>
>>   <xs:element name="Day" type="xs:date"/>
>>
>> and by calling xjc you get Java code with annotations
>>
>>    @XmlElement(name = "Day", required = true)
>>    @XmlSchemaType(name = "date")
>>    protected XMLGregorianCalendar day;
>>
>> and the usual getter and setter. I'd expect that a schemagen from this
>> should give you what you want, but I haven't tried it.
>>
>> HTH
>> -W
>>
>>
>> On 29 November 2011 17:21,  <jeremychocolate_at_gmail.com> wrote:
>> > I am working on a web service using CXF/JAXB. I am trying to modify the
>> > generated XML schema for a date parameter.
>> >
>> > Given the following method signature:
>> > public void Something(Date theDate);
>> >
>> > How can I modify theDate such that it’s schema is xs:date rather than
>> > xs:dateTime?
>> >
>> > What I would like to do:
>> > public void Something(@XmlSchemaType(name=”date”)Date theDate);
>> >
>> > I have endorsed jaxb-api v2.2.1, which has allowed me to add the
>> > XmlElement annotation, on theDate, but I really need the XmlSchemaType
>> > annotation (or is there a way to use the type attribute of XmlElement?)
>> >
>> >
>> > Thanks,
>> > Jeremy Robertson
>
>