[forge-users] @Option explanations please

George Gastaldi ggastald at redhat.com
Mon Nov 3 23:47:42 EST 2014


Hi Jérôme,

value() is meant to be the parameter name. Since this annotation method can be written in the form @Option("named"), we (the forge team) decided to use it to represent the option name. (Eg: my-command --named xxx)

DefaultValue as the name implies is the value set in the option when it is not filled.

The "type" as the javadoc states, is the input type hint (eg: should the option be rendered as a combo box, radio buttons, etc) and the valid values are defined in the InputType interface. In order to allow extensibility, we decided to use String to represent it, so people could write plugin extensions and render an input in the way they like. As you might have guessed, it is not used in the CLI version, only in IDEs.

Let me know if I have answered your questions, looking forward to reading this article ;)

Best Regards,

George Gastaldi

> Em 03/11/2014, às 20:52, forge-users at lists.jboss.org escreveu:
> 
> Hi,
> 
> I'm currently writing an article about Forge addons.
> I'm beginning to write an addon, with @Command to start slowly and get the reader hooked.
> 
> I'm a bit puzzled with the behaviour of @Option .
> Attribute "value" is mandatory, OK but if I define a value, it is not displayed. Why ??
> The defaultValue has to be defined so it is displayed.
> 
> What are value and defaultValue for ?
> How do they interact together ?
> 
> About the 'type' attribute. Is there other types than String supported ? 
> Integer and Long seem not to be recognized (or enforced).
> 
> Thank you 
> 
> Jérôme
> 
> Posted by forums
> Original post: https://developer.jboss.org/message/908979#908979
> 
> _______________________________________________
> forge-users mailing list
> forge-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-users



More information about the forge-users mailing list