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.PluginPluginthat 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 StringOPTION_NAMEConstant for the option string.
-
Constructor Summary
Constructors Constructor Description CamelCasePlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetOptionName()Returns the option string used to turn on this plugin.StringgetUsage()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.
-
-
-
Field Detail
-
OPTION_NAME
protected final String OPTION_NAME
Constant for the option string.- See Also:
- Constant Field Values
-
-
Method Detail
-
getOptionName
public String 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
public String 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.BadCommandLineExceptionOn 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.
-
-