Class DefaultValuePlugin

java.lang.Object
com.sun.tools.xjc.Plugin
org.jvnet.jaxb.plugin.defaultvalueplugin.DefaultValuePlugin

public class DefaultValuePlugin extends com.sun.tools.xjc.Plugin
Modifies the JAXB code model to set default values to the schema "default" attribute. Currently, the following field types can be initialized: Created: Mon Apr 24 22:04:25 2006
Version:
1.1
Author:
Hari Selvarajan, J�rgen Lukasczyk
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new DefaultValuePlugin instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    DefaultValuePlugin uses "-Xdefault-value" as the command-line argument
    Return usage information for plugin
    int
    parseArgument(com.sun.tools.xjc.Options opt, String[] args, int i)
     
    boolean
    run(com.sun.tools.xjc.outline.Outline outline, com.sun.tools.xjc.Options opt, ErrorHandler errorHandler)
    Run the plugin.

    Methods inherited from class com.sun.tools.xjc.Plugin

    getCustomizationURIs, isCustomizationTagName, onActivated, postProcessModel

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultValuePlugin

      public DefaultValuePlugin()
      Creates a new DefaultValuePlugin instance.
  • Method Details

    • getOptionName

      public String getOptionName()
      DefaultValuePlugin uses "-Xdefault-value" as the command-line argument
      Specified by:
      getOptionName in class com.sun.tools.xjc.Plugin
    • getUsage

      public String getUsage()
      Return usage information for plugin
      Specified by:
      getUsage in class com.sun.tools.xjc.Plugin
    • run

      public boolean run(com.sun.tools.xjc.outline.Outline outline, com.sun.tools.xjc.Options opt, ErrorHandler errorHandler)
      Run the plugin. We perform the following steps:
      • Look for fields that:
        • Were generated from XSD description
        • The XSD description is of type xsd:element (or xsd:attribute if all is set)
        • A default value is specified
        • Map to one of the supported types
      • Add a new initializsation expression to every field found
      Specified by:
      run in class com.sun.tools.xjc.Plugin
    • parseArgument

      public int parseArgument(com.sun.tools.xjc.Options opt, String[] args, int i)
      Overrides:
      parseArgument in class com.sun.tools.xjc.Plugin