The defaultValue provides a value for the Usage message in these cases.
I could probably figure out how to get the default value out of the
field, but it wasn't worth the effort. I just reused the defaultValue
annotation that was already in @Param.
Byron Nevins wrote on 03/23/10 01:22 PM:
> I wonder how that works? The variables are already set to a default.
> E.g. below the variable debug is already false. Since the param is not
> given, the injector does a no-op leaving the variable still set to
> false. It appears that the defaultValue does nothing useful other than
> resetting the variable to the same value.
>
> It would be interesting to set a BP in HK2 inject code and see what it
> does...
>
> On 3/23/2010 11:56 AM, Bill Shannon wrote:
>> Jennifer Chou wrote on 03/23/10 08:00 AM:
>>> Not sure if you need to add defaultValue to Param, but I saw them added
>>> in other places.
>>>
>>> LocalDomainCommand.java - looks ok
>>>
>>> DeleteDomainCommand.java - looks ok to me.
>>>
>>> StopDomainCommand.java - look ok
>>>
>>> StartDomainCommand.java: add defaultValue="false"?
>>>
>>> 70
>>> 71 @Param(optional = true,* defaultValue="false"*)
>>> 72 private boolean verbose;
>>> 73
>>> 74 @Param(optional = true,**defaultValue="false"**)
>>> 75 private boolean upgrade;
>>> 76
>>> 77 @Param(optional = true,**defaultValue="false"**)
>>> 78 private boolean debug;
>>>
>>>
>>> MonitorCommand.java - add defaultValue="30"?
>>>
>>> 61 @Param(optional = true,*defaultValue="30"*)
>>> 62 private int interval = 30; // default 30 seconds
>>
>> Yup, I should fix these too.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>