You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by Balazs Kollar <ba...@gmail.com> on 2008/04/18 15:47:17 UTC

wsdl2java-generated beans are not Introspector compliant

Dear all,

I am just integrating CXF into our java project, and I have run into the
following problem. If a generated class has a field of type Boolean, its
getter method will start with "is", not "get", as it should. This causes a
problem if you want to process the bean with apache-beanutils (or
java.beans.Introspector), because those treat the field as read-only.
The correct prefix for these fields is "get".

In detail: The XSD data type was the following: <xs:element minOccurs="0"
name="enabled" type="xs:boolean"/>

The class generated is like this:

public class UserDTO {
protected Boolean deleted;
public Boolean isDeleted() { return deleted; }
...
}

Please fix this in CXF 2.1, if it is possible.

Thanks,
Balázs
Java Developer,
http://www.statlogics.com/

Re: wsdl2java-generated beans are not Introspector compliant

Posted by Glen Mazza <gl...@verizon.net>.
Yes, perhaps it is Bean Utils (http://commons.apache.org/beanutils/)
that needs to be changed.

Glen


Daniel Kulp wrote:
> This is not something we have control over.   This is per JAXB 
> sepcification.   Section 5.5.1 of the JAXB spec specifically states that 
> boolean values are mapped to "isXXX()", not "getXXX".
> 
> In anycase, we don't do the schema->java bean mapping.   That is handled 
> by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will 
> use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.  
> Thus, someething MIGHT be different in this case, but I don't expect it 
> to be since the spec is pretty clear about it.
> 
> Dan
> 
> 
> On Friday 18 April 2008, Balazs Kollar wrote:
> > Dear all,
> >
> > I am just integrating CXF into our java project, and I have run into
> > the following problem. If a generated class has a field of type
> > Boolean, its getter method will start with "is", not "get", as it
> > should. This causes a problem if you want to process the bean with
> > apache-beanutils (or java.beans.Introspector), because those treat the
> > field as read-only. The correct prefix for these fields is "get".
> >
> > In detail: The XSD data type was the following: <xs:element
> > minOccurs="0" name="enabled" type="xs:boolean"/>
> >
> > The class generated is like this:
> >
> > public class UserDTO {
> > protected Boolean deleted;
> > public Boolean isDeleted() { return deleted; }
> > ...
> > }
> >
> > Please fix this in CXF 2.1, if it is possible.
> >
> > Thanks,
> > Balázs
> > Java Developer,
> > http://www.statlogics.com/
> 
> 
> 


Re: wsdl2java-generated beans are not Introspector compliant

Posted by Glen Mazza <gl...@verizon.net>.
Yes, perhaps it is Bean Utils (http://commons.apache.org/beanutils/)
that needs to be changed.

Glen


Daniel Kulp wrote:
> This is not something we have control over.   This is per JAXB 
> sepcification.   Section 5.5.1 of the JAXB spec specifically states that 
> boolean values are mapped to "isXXX()", not "getXXX".
> 
> In anycase, we don't do the schema->java bean mapping.   That is handled 
> by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will 
> use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.  
> Thus, someething MIGHT be different in this case, but I don't expect it 
> to be since the spec is pretty clear about it.
> 
> Dan
> 
> 
> On Friday 18 April 2008, Balazs Kollar wrote:
> > Dear all,
> >
> > I am just integrating CXF into our java project, and I have run into
> > the following problem. If a generated class has a field of type
> > Boolean, its getter method will start with "is", not "get", as it
> > should. This causes a problem if you want to process the bean with
> > apache-beanutils (or java.beans.Introspector), because those treat the
> > field as read-only. The correct prefix for these fields is "get".
> >
> > In detail: The XSD data type was the following: <xs:element
> > minOccurs="0" name="enabled" type="xs:boolean"/>
> >
> > The class generated is like this:
> >
> > public class UserDTO {
> > protected Boolean deleted;
> > public Boolean isDeleted() { return deleted; }
> > ...
> > }
> >
> > Please fix this in CXF 2.1, if it is possible.
> >
> > Thanks,
> > Balázs
> > Java Developer,
> > http://www.statlogics.com/
> 
> 
> 


Re: wsdl2java-generated beans are not Introspector compliant

Posted by Balazs Kollar <ba...@gmail.com>.
As I see the problem exists a long time ago:

See
http://www.mojavelinux.com/blog/archives/2006/09/the_great_jaxb_api_blunder/

Balázs

2008/4/18, Daniel Kulp <dk...@apache.org>:
>
>
> This is not something we have control over.   This is per JAXB
> sepcification.   Section 5.5.1 of the JAXB spec specifically states that
> boolean values are mapped to "isXXX()", not "getXXX".
>
> In anycase, we don't do the schema->java bean mapping.   That is handled
> by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will
> use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.
> Thus, someething MIGHT be different in this case, but I don't expect it
> to be since the spec is pretty clear about it.
>
> Dan
>
>
>
> On Friday 18 April 2008, Balazs Kollar wrote:
> > Dear all,
> >
> > I am just integrating CXF into our java project, and I have run into
> > the following problem. If a generated class has a field of type
> > Boolean, its getter method will start with "is", not "get", as it
> > should. This causes a problem if you want to process the bean with
> > apache-beanutils (or java.beans.Introspector), because those treat the
> > field as read-only. The correct prefix for these fields is "get".
> >
> > In detail: The XSD data type was the following: <xs:element
> > minOccurs="0" name="enabled" type="xs:boolean"/>
> >
> > The class generated is like this:
> >
> > public class UserDTO {
> > protected Boolean deleted;
> > public Boolean isDeleted() { return deleted; }
> > ...
> > }
> >
> > Please fix this in CXF 2.1, if it is possible.
> >
> > Thanks,
> > Balázs
> > Java Developer,
> > http://www.statlogics.com/
>
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>



-- 
Balázs

"A good indication of when you are really starting to get to grips with a
subject, I find, is when you start to know the right questions to ask.
(Knowing the answers to these questions comes much later. That's expertise.)
Once you are at this point, you can really start to take off: if only
because once at this point, Google can usually help you out."

Re: wsdl2java-generated beans are not Introspector compliant

Posted by Balazs Kollar <ba...@gmail.com>.
Strange, because in this case I use the Boolean wrapper object (which
can be null), not the simple type. And beanutils uses the introspector
of the JVM to find getters. I will check the specification, either.

On 4/18/08, Daniel Kulp <dk...@apache.org> wrote:
>
> This is not something we have control over.   This is per JAXB
> sepcification.   Section 5.5.1 of the JAXB spec specifically states that
> boolean values are mapped to "isXXX()", not "getXXX".
>
> In anycase, we don't do the schema->java bean mapping.   That is handled
> by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will
> use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.
> Thus, someething MIGHT be different in this case, but I don't expect it
> to be since the spec is pretty clear about it.
>
> Dan
>
>
> On Friday 18 April 2008, Balazs Kollar wrote:
> > Dear all,
> >
> > I am just integrating CXF into our java project, and I have run into
> > the following problem. If a generated class has a field of type
> > Boolean, its getter method will start with "is", not "get", as it
> > should. This causes a problem if you want to process the bean with
> > apache-beanutils (or java.beans.Introspector), because those treat the
> > field as read-only. The correct prefix for these fields is "get".
> >
> > In detail: The XSD data type was the following: <xs:element
> > minOccurs="0" name="enabled" type="xs:boolean"/>
> >
> > The class generated is like this:
> >
> > public class UserDTO {
> > protected Boolean deleted;
> > public Boolean isDeleted() { return deleted; }
> > ...
> > }
> >
> > Please fix this in CXF 2.1, if it is possible.
> >
> > Thanks,
> > Balázs
> > Java Developer,
> > http://www.statlogics.com/
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>

-- 
Sent from Gmail for mobile | mobile.google.com

Balázs

"A good indication of when you are really starting to get to grips
with a subject, I find, is when you start to know the right questions
to ask. (Knowing the answers to these questions comes much later.
That's expertise.) Once you are at this point, you can really start to
take off: if only because once at this point, Google can usually help
you out."

Re: wsdl2java-generated beans are not Introspector compliant

Posted by Daniel Kulp <dk...@apache.org>.
This is not something we have control over.   This is per JAXB 
sepcification.   Section 5.5.1 of the JAXB spec specifically states that 
boolean values are mapped to "isXXX()", not "getXXX".

In anycase, we don't do the schema->java bean mapping.   That is handled 
by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will 
use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.  
Thus, someething MIGHT be different in this case, but I don't expect it 
to be since the spec is pretty clear about it.

Dan


On Friday 18 April 2008, Balazs Kollar wrote:
> Dear all,
>
> I am just integrating CXF into our java project, and I have run into
> the following problem. If a generated class has a field of type
> Boolean, its getter method will start with "is", not "get", as it
> should. This causes a problem if you want to process the bean with
> apache-beanutils (or java.beans.Introspector), because those treat the
> field as read-only. The correct prefix for these fields is "get".
>
> In detail: The XSD data type was the following: <xs:element
> minOccurs="0" name="enabled" type="xs:boolean"/>
>
> The class generated is like this:
>
> public class UserDTO {
> protected Boolean deleted;
> public Boolean isDeleted() { return deleted; }
> ...
> }
>
> Please fix this in CXF 2.1, if it is possible.
>
> Thanks,
> Balázs
> Java Developer,
> http://www.statlogics.com/



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: wsdl2java-generated beans are not Introspector compliant

Posted by Daniel Kulp <dk...@apache.org>.
This is not something we have control over.   This is per JAXB 
sepcification.   Section 5.5.1 of the JAXB spec specifically states that 
boolean values are mapped to "isXXX()", not "getXXX".

In anycase, we don't do the schema->java bean mapping.   That is handled 
by the JAXB runtime code generator from Sun, not CXF code.  CXF 2.1 will 
use the 2.1.6 version of the JAXB generators whereas 2.0.x uses 2.0.  
Thus, someething MIGHT be different in this case, but I don't expect it 
to be since the spec is pretty clear about it.

Dan


On Friday 18 April 2008, Balazs Kollar wrote:
> Dear all,
>
> I am just integrating CXF into our java project, and I have run into
> the following problem. If a generated class has a field of type
> Boolean, its getter method will start with "is", not "get", as it
> should. This causes a problem if you want to process the bean with
> apache-beanutils (or java.beans.Introspector), because those treat the
> field as read-only. The correct prefix for these fields is "get".
>
> In detail: The XSD data type was the following: <xs:element
> minOccurs="0" name="enabled" type="xs:boolean"/>
>
> The class generated is like this:
>
> public class UserDTO {
> protected Boolean deleted;
> public Boolean isDeleted() { return deleted; }
> ...
> }
>
> Please fix this in CXF 2.1, if it is possible.
>
> Thanks,
> Balázs
> Java Developer,
> http://www.statlogics.com/



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog