ToString plugin
ToString plugin
ToString plugin generates toString(...) methods:
public class PurchaseOrderType implements ToString //, ... // ... public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); } public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; } public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { USAddress theShipTo; theShipTo = this.getShipTo(); strategy.appendField(locator, this, "shipTo", buffer, theShipTo); } { USAddress theBillTo; theBillTo = this.getBillTo(); strategy.appendField(locator, this, "billTo", buffer, theBillTo); } // ... return buffer; } // ... }
Generated methods allow you to specify a custom object-to-string conversion strategy (to-string strategy).
Activation
Use the -XtoString argument to activate the plugin.
Configuration
By default, generated code uses org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy as to-string strategy. You can specify class name of your custom strategy using the -XtoString-toStringStrategyClass argument:
-XtoString-toStringStrategyClass=com.acme.foo.CustomToStringStrategy