users@jaxb.java.net

xjc Plugin - custom header / suppress checkstyle

From: <alfon.wenzler_at_sdm.de>
Date: Tue, 26 Feb 2008 17:46:18 +0100

Hi,

I want to write a xjc Plugin for supressing Checkstyle for the generated
classes. All I want to do is to change / set the header to contain
CHECKSTYLE:OFF.

When headers are not suppressed they look like this:

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB)
Reference Implementation, v2.0.5-b02-fcs
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the
source schema.
// Generated on: 2008.02.26 at 05:04:09 PM CET
//

With this Plugin it should look like this:

// CHECKSTYLE:OFF
//
// This file was generated..
//

How can I get and change this header text in a Plugin? As a workaround I had
the idea of adding CHECKSTYLE:OFF in the JavaDoc of generated classes.
However, the Plugin is executed but without any effect. Can anybody tell me
why the javadoc is not extended?


    /** {_at_inheritDoc} */
    @Override
    public boolean run(Outline model, Options options, ErrorHandler
errorHandler) {

        for (ClassOutline co : model.getClasses()) {
            co.target.javadoc = "CHECKSTYLE:OFF\n\n" + co.target.javadoc;
        }

        return true;
    }


Thanks a lot!
Luc