admin@glassfish.java.net

Re: New _at_Param abilities

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Tue, 08 Apr 2008 14:56:52 -0700

Kedar Mhaswade wrote:
> I don't get it. I hope you are taking into account the
> "default-value (defaultValue)" of an @Param. If nothing is specified
> on command line, the injected object should have default
> value if there exists one.
>
Yes -- that will work fine. The deafultValue (if needed & available) is
retrieved before checking against the acceptableValue's.

Of course, your defaultValue had better be in the list of acceptedValue's!
>
> Byron Nevins wrote:
>> There are 2 new Param annotation possibilities for AdminCommand's
>>
>> @Param(acceptableValues="foo,bar.xyz")
>> String aString;
>>
>> aString will either be null, empty, foo, bar, or xyz
>>
>> If anything else is given then the command will fail at injection
>> time -- before execute() is called
>>
>> /Call for comments -- should null and/or empty be errors?/
>> ______________________
>>
>> @Param
>> Boolean myBool;
>>
>> If the parameter is not given at all (i.e. no --myBool) then myBool
>> == whatever you set it to in the declaration
>
> With injection, why do you set it in the declaration?
> It should be something like:
> @Param
> Boolean myBool(defaultValue=false); in which case the
> value of myBool should be false when not specified on command line.
>
>>
>> If the parameter is given -- this is how it works:
>>
>> null or empty string --> true
>> case-insensitive match of "true" --> true
>> case-insensitive match of "false" --> false
>> anything else --> fatal error. AdminCommand.execute() will NOT be
>> called
>>
>> If you have developed an AdminCommand that uses boolean options, I
>> urge you to change to the new capability above.
>>
>>
>> --
>> Byron Nevins Work 408-276-4089, Home 650-359-1290, Cell 650-784-4123
>> - Sun Microsystems, Inc.
>>
>> ---------------------------------------------------------------------
>> 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
>

-- 
Byron Nevins Work 408-276-4089, Home 650-359-1290, Cell 650-784-4123 - Sun Microsystems, Inc.