Class CamelCasePlugin


  • public class CamelCasePlugin
    extends com.sun.tools.xjc.Plugin
    Plugin that always converts an XML name into a camel case java name. This plugin changes the first character of every word composing an XML name to uppercase and the others to lowercase, while the default XJC behavior is to do so only if the first character of the word is lowercase.
    
     XJC default:
       FIRST_NAME -> FIRSTNAME
       FOOBar     -> FOOBar
       SSNCode    -> SSNCode
    
     Camel case always:
       FIRST_NAME -> FirstName
       FOOBar     -> FooBar
       SSNCode    -> SsnCode
    
     
    Author:
    Nicola Fagnani This plugin came from here : org.andromda.thirdparty.jaxb2_commons:camelcase-always:1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String OPTION_NAME
      Constant for the option string.
    • Constructor Summary

      Constructors 
      Constructor Description
      CamelCasePlugin()  
    • Constructor Detail

      • CamelCasePlugin

        public CamelCasePlugin()
    • Method Detail

      • getOptionName

        public String getOptionName()
        Returns the option string used to turn on this plugin.
        Specified by:
        getOptionName in class com.sun.tools.xjc.Plugin
        Returns:
        option string to invoke this plugin
      • getUsage

        public String getUsage()
        Returns a string specifying how to use this plugin and what it does.
        Specified by:
        getUsage in class com.sun.tools.xjc.Plugin
        Returns:
        string containing the plugin usage message
      • onActivated

        public void onActivated​(com.sun.tools.xjc.Options opts)
                         throws com.sun.tools.xjc.BadCommandLineException
        On plugin activation, sets a customized NameConverter to adjust code generation.
        Overrides:
        onActivated in class com.sun.tools.xjc.Plugin
        Parameters:
        opts - options used to invoke XJC
        Throws:
        com.sun.tools.xjc.BadCommandLineException - if the plugin is invoked with wrong parameters
      • run

        public boolean run​(com.sun.tools.xjc.outline.Outline model,
                           com.sun.tools.xjc.Options opts,
                           ErrorHandler errorHandler)
        Returns true without touching the generated code. All the relevant work is done during name conversion.
        Specified by:
        run in class com.sun.tools.xjc.Plugin
        Parameters:
        model - This object allows access to various generated code.
        opts - options used to invoke XJC
        errorHandler - Errors should be reported to this handler.
        Returns:
        If the add-on executes successfully, return true. If it detects some errors but those are reported and recovered gracefully, return false.