You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "John G. Norman" <jo...@7fff.com> on 2007/09/24 22:09:29 UTC

Axis2 1.3: Generated stubs have *Marker methods?

I notice that my generated stubs now have some new methods. If I have a
method getPhoneNumber I now have an extra getPhoneNumberMarker. I think. I
looked at for about 10 seconds.

What's that about?

(Broke a bunch of my unit tests . . .)

John

Re: Axis2 1.3: Generated stubs have *Marker methods?

Posted by "John G. Norman" <jo...@7fff.com>.
Amila,

I have classes that extend the stubs.

Those classes use the Commons equals builder, hash builder, etc.

Commons equals builder, etc., uses reflection to build methods, and they can
see protected getters.

Therefore, the addition of these protected methods breaks code -- not to
mention the fact that it is polluting the method namespace.

John

On 9/28/07, Amila Suriarachchi <am...@gmail.com> wrote:
>
> yes this tracker variable used to validate the input message when
> serailizing.
> if you want to generate the seperate classes use -u option.
>
> still I am not clear about your problem.
>
> Amila.
>
> On 9/26/07, John G. Norman <jo...@7fff.com> wrote:
> >
> > Here is what goes on:
> >
> > The generated stub introduces new protected attributes. Before there was
> > only local<yourAttribute>
> >
> > Now there is not only local<yourAttribute> but
> > local<yourAttribute>Tracker
> >
> > The Tracker attribute is used to detect when the setter is called, so
> > that the field can serialized conditionally.
> >
> > The gotcha for me is that if you extend from it and then use Commons
> > EqualsBuilder, the EqualsBuilder will see these new members and will return
> > surprisingly results unless the Tracker methods are excluded.
> >
> > It's a drag to change the state of an object without telling people . .
> > .
> >
> > A snippet from a generated Stub:
> >
> >                         /**
> >                         * field for Discontinued
> >                         */
> >
> >
> >                             protected boolean localDiscontinued ;
> >
> >                            /*  This tracker boolean wil be used to
> > detect whether the user called the set method
> >                           *   for this attribute. It will be used to
> > determine whether to include this field
> >                            *   in the serialized XML
> >                            */
> >                            protected boolean localDiscontinuedTracker =
> > false ;
> >
> >
> >                            /**
> >                            * Auto generated getter method
> >                            * @return boolean
> >                            */
> >                            public  boolean getDiscontinued(){
> >                                return localDiscontinued;
> >                            }
> >
> >
> >
> >                             /**
> >                                * Auto generated setter method
> >                                * @param param Discontinued
> >                                */
> >                                public void setDiscontinued(boolean
> > param){
> >
> >                                        // setting primitive attribute
> > tracker to true
> >
> >                                                if (false) {
> >                                            localDiscontinuedTracker =
> > false;
> >
> >                                        } else {
> >                                           localDiscontinuedTracker =
> > true;
> >                                        }
> >
> >                                             this.localDiscontinued=param
> > ;
> >
> >
> >                                }
> >
> >
> > On 9/25/07, Amila Suriarachchi <am...@gmail.com> wrote:
> > >
> > > these methods are generated per operation. please check whether there
> > > is an operation with this name.
> > >
> > > Amila.
> > >
> > > On 9/25/07, John G. Norman < john@7fff.com> wrote:
> > > >
> > > > I notice that my generated stubs now have some new methods. If I
> > > > have a method getPhoneNumber I now have an extra getPhoneNumberMarker. I
> > > > think. I looked at for about 10 seconds.
> > > >
> > > > What's that about?
> > > >
> > > > (Broke a bunch of my unit tests . . .)
> > > >
> > > > John
> > > >
> > > >
> > >
> > >
> > > --
> > > Amila Suriarachchi,
> > > WSO2 Inc.
> >
> >
> >
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.

Re: Axis2 1.3: Generated stubs have *Marker methods?

Posted by Amila Suriarachchi <am...@gmail.com>.
yes this tracker variable used to validate the input message when
serailizing.
if you want to generate the seperate classes use -u option.

still I am not clear about your problem.

Amila.

On 9/26/07, John G. Norman <jo...@7fff.com> wrote:
>
> Here is what goes on:
>
> The generated stub introduces new protected attributes. Before there was
> only local<yourAttribute>
>
> Now there is not only local<yourAttribute> but local<yourAttribute>Tracker
>
>
> The Tracker attribute is used to detect when the setter is called, so that
> the field can serialized conditionally.
>
> The gotcha for me is that if you extend from it and then use Commons
> EqualsBuilder, the EqualsBuilder will see these new members and will return
> surprisingly results unless the Tracker methods are excluded.
>
> It's a drag to change the state of an object without telling people . . .
>
> A snippet from a generated Stub:
>
>                         /**
>                         * field for Discontinued
>                         */
>
>
>                             protected boolean localDiscontinued ;
>
>                            /*  This tracker boolean wil be used to detect
> whether the user called the set method
>                           *   for this attribute. It will be used to
> determine whether to include this field
>                            *   in the serialized XML
>                            */
>                            protected boolean localDiscontinuedTracker =
> false ;
>
>
>                            /**
>                            * Auto generated getter method
>                            * @return boolean
>                            */
>                            public  boolean getDiscontinued(){
>                                return localDiscontinued;
>                            }
>
>
>
>                             /**
>                                * Auto generated setter method
>                                * @param param Discontinued
>                                */
>                                public void setDiscontinued(boolean param){
>
>                                        // setting primitive attribute
> tracker to true
>
>                                                if (false) {
>                                            localDiscontinuedTracker =
> false;
>
>                                        } else {
>                                           localDiscontinuedTracker = true;
>                                        }
>
>                                             this.localDiscontinued=param;
>
>
>                                }
>
>
> On 9/25/07, Amila Suriarachchi <am...@gmail.com> wrote:
> >
> > these methods are generated per operation. please check whether there is
> > an operation with this name.
> >
> > Amila.
> >
> > On 9/25/07, John G. Norman < john@7fff.com> wrote:
> > >
> > > I notice that my generated stubs now have some new methods. If I have
> > > a method getPhoneNumber I now have an extra getPhoneNumberMarker. I think. I
> > > looked at for about 10 seconds.
> > >
> > > What's that about?
> > >
> > > (Broke a bunch of my unit tests . . .)
> > >
> > > John
> > >
> > >
> >
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
>
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Axis2 1.3: Generated stubs have *Marker methods?

Posted by "John G. Norman" <jo...@7fff.com>.
Here is what goes on:

The generated stub introduces new protected attributes. Before there was
only local<yourAttribute>

Now there is not only local<yourAttribute> but local<yourAttribute>Tracker

The Tracker attribute is used to detect when the setter is called, so that
the field can serialized conditionally.

The gotcha for me is that if you extend from it and then use Commons
EqualsBuilder, the EqualsBuilder will see these new members and will return
surprisingly results unless the Tracker methods are excluded.

It's a drag to change the state of an object without telling people . . .

A snippet from a generated Stub:

                        /**
                        * field for Discontinued
                        */


                            protected boolean localDiscontinued ;

                           /*  This tracker boolean wil be used to detect
whether the user called the set method
                          *   for this attribute. It will be used to
determine whether to include this field
                           *   in the serialized XML
                           */
                           protected boolean localDiscontinuedTracker =
false ;


                           /**
                           * Auto generated getter method
                           * @return boolean
                           */
                           public  boolean getDiscontinued(){
                               return localDiscontinued;
                           }



                            /**
                               * Auto generated setter method
                               * @param param Discontinued
                               */
                               public void setDiscontinued(boolean param){

                                       // setting primitive attribute
tracker to true

                                               if (false) {
                                           localDiscontinuedTracker = false;

                                       } else {
                                          localDiscontinuedTracker = true;
                                       }

                                            this.localDiscontinued=param;


                               }


On 9/25/07, Amila Suriarachchi <am...@gmail.com> wrote:
>
> these methods are generated per operation. please check whether there is
> an operation with this name.
>
> Amila.
>
> On 9/25/07, John G. Norman < john@7fff.com> wrote:
> >
> > I notice that my generated stubs now have some new methods. If I have a
> > method getPhoneNumber I now have an extra getPhoneNumberMarker. I think. I
> > looked at for about 10 seconds.
> >
> > What's that about?
> >
> > (Broke a bunch of my unit tests . . .)
> >
> > John
> >
> >
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.

Re: Axis2 1.3: Generated stubs have *Marker methods?

Posted by Amila Suriarachchi <am...@gmail.com>.
these methods are generated per operation. please check whether there is an
operation with this name.

Amila.

On 9/25/07, John G. Norman <jo...@7fff.com> wrote:
>
> I notice that my generated stubs now have some new methods. If I have a
> method getPhoneNumber I now have an extra getPhoneNumberMarker. I think. I
> looked at for about 10 seconds.
>
> What's that about?
>
> (Broke a bunch of my unit tests . . .)
>
> John
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.