Package org.jvnet.jaxb.plugin.camelcase
Class CamelCasePlugin
java.lang.Object
com.sun.tools.xjc.Plugin
org.jvnet.jaxb.plugin.camelcase.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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the option string used to turn on this plugin.getUsage()Returns a string specifying how to use this plugin and what it does.voidonActivated(com.sun.tools.xjc.Options opts) On plugin activation, sets a customized NameConverter to adjust code generation.booleanrun(com.sun.tools.xjc.outline.Outline model, com.sun.tools.xjc.Options opts, ErrorHandler errorHandler) Returns true without touching the generated code.Methods inherited from class com.sun.tools.xjc.Plugin
getCustomizationURIs, isCustomizationTagName, parseArgument, postProcessModel
-
Field Details
-
OPTION_NAME
Constant for the option string.- See Also:
-
-
Constructor Details
-
CamelCasePlugin
public CamelCasePlugin()
-
-
Method Details
-
getOptionName
Returns the option string used to turn on this plugin.- Specified by:
getOptionNamein classcom.sun.tools.xjc.Plugin- Returns:
- option string to invoke this plugin
-
getUsage
Returns a string specifying how to use this plugin and what it does.- Specified by:
getUsagein classcom.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:
onActivatedin classcom.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:
runin classcom.sun.tools.xjc.Plugin- Parameters:
model- This object allows access to various generated code.opts- options used to invoke XJCerrorHandler- 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.
-