3 Replies Latest reply on Nov 4, 2014 9:48 AM by gastaldi

    @Option explanations please

    alwad

      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

        • 1. Re: [forge-users] @Option explanations please
          gastaldi

          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@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@lists.jboss.org

          https://lists.jboss.org/mailman/listinfo/forge-users

           

          _______________________________________________

          forge-users mailing list

          forge-users@lists.jboss.org

          https://lists.jboss.org/mailman/listinfo/forge-users

           

           

          • 2. Re: @Option explanations please
            alwad

            Thank you George,

             

            The addon article will follow a first article on "using Forge2" to be published early 2015 in the French GNU/Linux Magazine.

            The message I put in the article is

            "you can build your tools simply, in Java, have them in Eclipse and CLI without learning SWT !!"


            I assume you would not learn anything from it but I'll happily send an issue of the magazine to Forge HQ when its at the newsstand.

             

            Expect more questions from me

             

            Best Regards,

             

            Jérôme ( @wadael )

            • 3. Re: [forge-users] @Option explanations please
              gastaldi

              That looks fantastic! It's not true that we'll not learn anything from

              it, we always learn something from articles.

              Let me know if this will be published online, so we can promote in our

              website, if possible

               

              On 11/04/2014 12:26 PM, forge-users@lists.jboss.org wrote:

              Thank you George,

               

              The addon article will follow a first article on "using Forge2" to be published early 2015 in the French GNU/Linux Magazine.

              The message I put in the article is

              "you can build your tools simply, in Java, have them in Eclipse and CLI without learning SWT !!"

               

              >

              I assume you would not learn anything from it but I'll happily send an issue of the magazine to Forge HQ when its at the newsstand.

               

              Expect more questions from me

               

              Best Regards,

               

              Jérôme ( @wadael )

               

              Posted by forums

              Original post: https://developer.jboss.org/message/909084#909084

               

              _______________________________________________

              forge-users mailing list

              forge-users@lists.jboss.org

              https://lists.jboss.org/mailman/listinfo/forge-users

               

              _______________________________________________

              forge-users mailing list

              forge-users@lists.jboss.org

              https://lists.jboss.org/mailman/listinfo/forge-users