cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF > cxf-xjc-ts
Date Fri, 22 Oct 2010 17:56:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/15/_/styles/combined.css?spaceKey=CXF&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF/cxf-xjc-ts">cxf-xjc-ts</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h2><a name="cxf-xjc-ts-CXFXJCtoStringPlugin"></a>CXF XJC toString
Plugin</h2>

<p>The CXF XJC toString Plugin provides and XJC plugin that updates the generated beans
to implement toString methods to override the default Object.toString method.   It uses Apache
Commons Lang ToStringBuilder class to build the String, so commons-lang.jar needs to be available
on the classpath.</p>

<p>It generates methods that look like:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    <span class="code-keyword">public</span> <span class="code-object">String</span>
toString() {
        <span class="code-keyword">return</span> ToStringBuilder.reflectionToString(<span
class="code-keyword">this</span>, ToStringStyle.DEFAULT_STYLE);
    }
</pre>
</div></div>

<p>The toString plugin can take a parameter to control what the generated toString method's
style looks like.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> -Xts </td>
<td class='confluenceTd'> Activate plugin to add a toString() method to generated classes.
 Equivalent to: -Xts:style:org.apache.cxf.jaxb.JAXBToStringStyle.DEFAULT_STYLE </td>
</tr>
<tr>
<td class='confluenceTd'> -Xts:style:multiline </td>
<td class='confluenceTd'> Have toString produce multi line output.   Equivalent to:
-Xts:style:org.apache.cxf.jaxb.JAXBToStringStyle.MULTI_LINE_STYLE </td>
</tr>
<tr>
<td class='confluenceTd'> -Xts:style:simple </td>
<td class='confluenceTd'> Have toString produce single line terse output. Equivalent
to: -Xts:style:org.apache.cxf.jaxb.JAXBToStringStyle.SIMPLE_STYLE </td>
</tr>
<tr>
<td class='confluenceTd'> -Xts:style:org.apache.commons.lang.builder.ToStringStyle.FIELD
</td>
<td class='confluenceTd'> The full class+field  name of the ToStringStyle to use. </td>
</tr>
</tbody></table>
</div>



<h3><a name="cxf-xjc-ts-TousewithMaven"></a>To use with Maven</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
           <span class="code-tag">&lt;plugin&gt;</span>
                <span class="code-tag">&lt;groupId&gt;</span>org.apache.cxf<span
class="code-tag">&lt;/groupId&gt;</span>
                <span class="code-tag">&lt;artifactId&gt;</span>cxf-xjc-plugin<span
class="code-tag">&lt;/artifactId&gt;</span>
                <span class="code-tag">&lt;executions&gt;</span>
                    <span class="code-tag">&lt;execution&gt;</span>
                        <span class="code-tag">&lt;goals&gt;</span>
                            <span class="code-tag">&lt;goal&gt;</span>xsdtojava<span
class="code-tag">&lt;/goal&gt;</span>
                        <span class="code-tag">&lt;/goals&gt;</span>
                    <span class="code-tag">&lt;/execution&gt;</span>
                <span class="code-tag">&lt;/executions&gt;</span>
                <span class="code-tag">&lt;configuration&gt;</span>
                    <span class="code-tag">&lt;xsdOptions&gt;</span>
                        <span class="code-tag">&lt;xsdOption&gt;</span>
                            <span class="code-tag">&lt;extension&gt;</span>true<span
class="code-tag">&lt;/extension&gt;</span>
                            <span class="code-tag">&lt;xsd&gt;</span>${basedir}/src/main/resources/schemas/configuration/foo.xsd<span
class="code-tag">&lt;/xsd&gt;</span>
                            <span class="code-tag">&lt;extensionArgs&gt;</span>
                                <span class="code-tag">&lt;arg&gt;</span>-Xts:style:multiline<span
class="code-tag">&lt;/arg&gt;</span>
                            <span class="code-tag">&lt;/extensionArgs&gt;</span>
                        <span class="code-tag">&lt;/xsdOption&gt;</span>
                    <span class="code-tag">&lt;/xsdOptions&gt;</span>
                    <span class="code-tag">&lt;extensions&gt;</span>
                        <span class="code-tag">&lt;extension&gt;</span>org.apache.cxf.xjcplugins:cxf-xjc-ts:2.3.0<span
class="code-tag">&lt;/extension&gt;</span>
                    <span class="code-tag">&lt;/extensions&gt;</span>
                <span class="code-tag">&lt;/configuration&gt;</span>
            <span class="code-tag">&lt;/plugin&gt;</span>

</pre>
</div></div>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/CXF/cxf-xjc-ts">View Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/CXF/cxf-xjc-ts?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message