Top Description Fields Constructors Methods
com.sun.tools.xjc.addon.at_generated

public Class PluginImpl

extends Plugin
Class Inheritance
Imports
com.sun.codemodel.JAnnotatable, .JAnnotationUse, .JClass, .JFieldVar, .JMethod, com.sun.tools.xjc.BadCommandLineException, .Driver, .Options, .Plugin, com.sun.tools.xjc.outline.ClassOutline, .EnumOutline, .Outline, .PackageOutline, java.io.IOException, java.time.ZonedDateTime, java.time.format.DateTimeFormatter, org.xml.sax.ErrorHandler

Plugin that marks the generated code by using '@Generated'.
Authors
Kohsuke Kawaguchi, Lukas Jungmann

Field Summary

Modifier and TypeField and Description
private JClass
private String
private String
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
augument(ClassOutline co)

Adds "@Generated" to the classes, methods, and fields.

private void
private String

Returns:

the date value
getISO8601Date
()

calculate the date value in ISO8601 format for the @Generated annotation

public String
getOptionName()

Implements abstract com.sun.tools.xjc.Plugin.getOptionName.

Gets the option name to turn on this add-on.

public String
getUsage()

Implements abstract com.sun.tools.xjc.Plugin.getUsage.

Gets the description of this add-on.

public int
parseArgument(Options opt, String[] args, int i)

Overrides com.sun.tools.xjc.Plugin.parseArgument.

Parses an option args[i] and augment the opt object appropriately, then return the number of tokens consumed.

public boolean
run(Outline model, Options opt, ErrorHandler errorHandler)

Implements abstract com.sun.tools.xjc.Plugin.run.

Run the add-on.

Inherited from com.sun.tools.xjc.Plugin:
getCustomizationURIsisCustomizationTagNameonActivatedpostProcessModel

Field Detail

annotationback to summary
private JClass annotation
dateback to summary
private String date
genAnnotationback to summary
private String genAnnotation
noDateback to summary
private boolean noDate

Constructor Detail

PluginImplback to summary
public PluginImpl()

Method Detail

annotateback to summary
private void annotate(JAnnotatable m)
augumentback to summary
private void augument(EnumOutline eo)
augumentback to summary
private void augument(ClassOutline co)

Adds "@Generated" to the classes, methods, and fields.

augumentback to summary
private void augument(PackageOutline po)
getISO8601Dateback to summary
private String getISO8601Date()

calculate the date value in ISO8601 format for the @Generated annotation

Returns:String

the date value

getOptionNameback to summary
public String getOptionName()

Implements abstract com.sun.tools.xjc.Plugin.getOptionName.

Doc from com.sun.tools.xjc.Plugin.getOptionName.

Gets the option name to turn on this add-on.

For example, if "abc" is returned, "-abc" will turn on this plugin. A plugin needs to be turned on explicitly, or else no other methods of will be invoked.

Starting 2.1, when an option matches the name returned from this method, XJC will then invoke parseArgument(Options, String[], int), allowing plugins to handle arguments to this option.

Annotations
@Override
getUsageback to summary
public String getUsage()

Implements abstract com.sun.tools.xjc.Plugin.getUsage.

Doc from com.sun.tools.xjc.Plugin.getUsage.

Gets the description of this add-on. Used to generate a usage screen.

Annotations
@Override
parseArgumentback to summary
public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException

Overrides com.sun.tools.xjc.Plugin.parseArgument.

Doc from com.sun.tools.xjc.Plugin.parseArgument.

Parses an option args[i] and augment the opt object appropriately, then return the number of tokens consumed.

The callee doesn't need to recognize the option that the getOptionName method returns.

Once a plugin is activated, this method is called for options that XJC didn't recognize. This allows a plugin to define additional options to customize its behavior.

Since options can appear in no particular order, XJC allows sub-options of a plugin to show up before the option that activates a plugin (one that's returned by getOptionName(). But nevertheless a needs to be activated to participate in further processing.

Annotations
@Override
Exceptions
BadCommandLineException:
If the option was recognized but there's an error. This halts the argument parsing process and causes XJC to abort, reporting an error.
runback to summary
public boolean run(Outline model, Options opt, ErrorHandler errorHandler)

Implements abstract com.sun.tools.xjc.Plugin.run.

Doc from com.sun.tools.xjc.Plugin.run.

Run the add-on.

This method is invoked after XJC has internally finished the code generation. Plugins can tweak some of the generated code (or add more code) by using Outline and Options.

Note that this method is invoked only when a is activated.

Annotations
@Override