You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2007/07/13 14:04:08 UTC

[jira] Created: (CXF-787) Add optional support for a toString method to JAXB generated types

Add optional support for a toString method to JAXB generated types
------------------------------------------------------------------

                 Key: CXF-787
                 URL: https://issues.apache.org/jira/browse/CXF-787
             Project: CXF
          Issue Type: New Feature
          Components: Tooling
    Affects Versions: 2.0.1
            Reporter: Gary Tully


A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 

This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully closed CXF-787.
--------------------------


> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>             Fix For: 2.0.1
>
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512456 ] 

Gary Tully commented on CXF-787:
--------------------------------

wsdl2java has support for using xjc extension plugins using the -xjc argument. My solution involves producing an xjc extension plugin that will add a toString method.



> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Eoghan Glynn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eoghan Glynn resolved CXF-787.
------------------------------

    Resolution: Fixed

> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512501 ] 

Gary Tully commented on CXF-787:
--------------------------------

patch applied, thanks Eoghan, http://svn.apache.org/viewvc?view=rev&rev=556005

> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512459 ] 

Gary Tully edited comment on CXF-787 at 7/13/07 5:27 AM:
---------------------------------------------------------

Details of file attachment with patch that implements an  xjc plugin called ts

The plugin provides a toString() method override on generated types.

The plugin is enabled throug the command line of through the wsdl2java common_build macro by the addition of the argument:
                <arg value="-xjc-Xts"/>

The plugin produces output in three styles:
<arg value="-xjc-Xts"/>                              : default: single line with field names

<arg value="-xjc-Xts,-Xts:style:simple> : single line with no field names or classnames

<arg value="-xjc-Xts,-Xts:style:multiline> : mulit line with field names

Example with the callback sample client.

Adding a System.out.println("ref=", ref) of the EndpointReferenType the client passes to the server produces:

     [java] ref=org.apache.cxf.ws.addressing.EndpointReferenceType@bf1f20[address=<null>,referenceParameters=<null>,metadata=org.apache.cxf.ws.addressing.MetadataType@8ef455[any=[javax.xml.bind.JAXBElement@14b2f1a, javax.xml.bind.JAXBElement@1017ca1],otherAttributes={{http://www.w3.org/2006/01/wsdl-instance}wsdlLocation=file:/C:/tnd/cxf_trunk/distribution/target/apache-cxf-2.1-incubator-SNAPSHOT.dir/apache-cxf-2.1-incubator-SNAPSHOT/samples/callback/wsdl/basic_callback.wsdl}],any=<null>,otherAttributes={}]



 was:
Thsi plugin provides a toString method on generated types.

The plugin is enabled throug the command line of through the wsdl2java via
                <arg value="-xjc-Xts"/>

there are three options:  

default: single line with fieldnames

<arg value="-xjc-Xts,-Xts:style:simple> : single line with no field names

<arg value="-xjc-Xts,-Xts:style:multiline> : mulit line with fieldnames

This is an example of the output with 

a System.out("ref=", ref) of EndpointReferenType (ref) in the callback Client with the default output style produces:

     [java] ref=org.apache.cxf.ws.addressing.EndpointReferenceType@bf1f20[address=<null>,referenceParameters=<null>,metadata=org.apache.cxf.ws.addressing.MetadataType@8ef455[any=[javax.xml.bind.JAXBElement@14b2f1a, javax.xml.bind.JAXBElement@1017ca1],otherAttributes={{http://www.w3.org/2006/01/wsdl-instance}wsdlLocation=file:/C:/tnd/cxf_trunk/distribution/target/apache-cxf-2.1-incubator-SNAPSHOT.dir/apache-cxf-2.1-incubator-SNAPSHOT/samples/callback/wsdl/basic_callback.wsdl}],any=<null>,otherAttributes={}]


> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512492 ] 

Gary Tully commented on CXF-787:
--------------------------------

This solution is inspired by the jaxb-commons-lang plugin[1] and depends on apache commons-lang 2.1

The motivation for doing our own plugin is four fold:
1) the existing one does not exist in a mvn repo that I can find
2) we cannot easily change the existing plugin
3) we may want to tie the behaviour/configuration of the toString styles to the runtime. (this was more of an issue when I thought we would have it enabled by default on the CXF shipped generated types). We may still want to do that.
4) we want to be able to provide this option out of the box 

[1] https://jaxb2-commons.dev.java.net/commons-lang-plugin/


> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-787) Add optional support for a toString method to JAXB generated types

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully updated CXF-787:
---------------------------

    Attachment: xjc-ts-plugin.gtully.patch

Thsi plugin provides a toString method on generated types.

The plugin is enabled throug the command line of through the wsdl2java via
                <arg value="-xjc-Xts"/>

there are three options:  

default: single line with fieldnames

<arg value="-xjc-Xts,-Xts:style:simple> : single line with no field names

<arg value="-xjc-Xts,-Xts:style:multiline> : mulit line with fieldnames

This is an example of the output with 

a System.out("ref=", ref) of EndpointReferenType (ref) in the callback Client with the default output style produces:

     [java] ref=org.apache.cxf.ws.addressing.EndpointReferenceType@bf1f20[address=<null>,referenceParameters=<null>,metadata=org.apache.cxf.ws.addressing.MetadataType@8ef455[any=[javax.xml.bind.JAXBElement@14b2f1a, javax.xml.bind.JAXBElement@1017ca1],otherAttributes={{http://www.w3.org/2006/01/wsdl-instance}wsdlLocation=file:/C:/tnd/cxf_trunk/distribution/target/apache-cxf-2.1-incubator-SNAPSHOT.dir/apache-cxf-2.1-incubator-SNAPSHOT/samples/callback/wsdl/basic_callback.wsdl}],any=<null>,otherAttributes={}]


> Add optional support for a toString method to JAXB generated types
> ------------------------------------------------------------------
>
>                 Key: CXF-787
>                 URL: https://issues.apache.org/jira/browse/CXF-787
>             Project: CXF
>          Issue Type: New Feature
>          Components: Tooling
>    Affects Versions: 2.0.1
>            Reporter: Gary Tully
>         Attachments: xjc-ts-plugin.gtully.patch
>
>
> A toString that gives a string representation of the xml content is required for generated JAXB types. This is an option that is available at code gen type, when wsdl2java is used and the result is a toString method that will coaless the content. A <null> string should be produced when a field in the type is absent. 
> This is handy for debugging and for logging.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.