Search code examples
javacxfxjccxf-xjc-plugin

How to use cxf-xjc-ts with ToStringBuilder from lang3?


When using the cxf-xjc-ts plugin during xsdtojava, one can add the property <extensionArg>-Xts</extensionArg> to let the compiler generate the following method:

import org.apache.commons.lang.builder.ToStringBuilder;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE);
    }

Problem: when having apache.commons-lang3 on classpath only, the package should be: org.apache.commons.lang3.builder.ToStringBuilder and using org.apache.commons.lang3.builder.DEFAULT_STYLE.

Question: how can I tell the -ts plugin to actually use the builder from lang3 during generation?


Solution

  • This has been fixed in v3.1.0 @see https://issues.apache.org/jira/browse/CXFXJC-16

    So now -Xts option is using lang3.