You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Daniel Cunha <da...@gmail.com> on 2015/02/22 04:59:31 UTC
Boolean checks
I saw that we have some cases like this:
"false".equalsIgnoreCase(ejbJar.properties.getProperty("openejb.cdi.activated"))
Doesn't is better use Boolean.parseBoolean()?
With parseBoolean it checks if the string argument is not null and is
equalsIgnoreCase to the "true"
For case like this:
"true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.cdi.debug",
"false")
not need to set a default value, for null value the result is false.
If we want an inverse logic, we need add only "!"
I think better. IMHO. :)
--
Daniel Cunha (soro)
Re: Boolean checks
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Was mainly to make obvious default and logic. ParseBoolean would make sense
if supporting more than true/false IMHO and if dupporting the default we
want everywhere.
That said while there is no regression I dont care.
Le 22 févr. 2015 05:41, "Bhupendra" <bh...@gmail.com> a écrit :
> Make sense.
>
> Bhupendra
> Sent from phone
>
>
> On 22-Feb-2015, at 9:29 AM, Daniel Cunha <da...@gmail.com> wrote:
>
> > I saw that we have some cases like this:
> >
> "false".equalsIgnoreCase(ejbJar.properties.getProperty("openejb.cdi.activated"))
> >
> > Doesn't is better use Boolean.parseBoolean()?
> > With parseBoolean it checks if the string argument is not null and is
> > equalsIgnoreCase to the "true"
> >
> > For case like this:
> >
> "true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.cdi.debug",
> > "false")
> >
> > not need to set a default value, for null value the result is false.
> > If we want an inverse logic, we need add only "!"
> >
> > I think better. IMHO. :)
> >
> > --
> > Daniel Cunha (soro)
>
Re: Boolean checks
Posted by Bhupendra <bh...@gmail.com>.
Make sense.
Bhupendra
Sent from phone
On 22-Feb-2015, at 9:29 AM, Daniel Cunha <da...@gmail.com> wrote:
> I saw that we have some cases like this:
> "false".equalsIgnoreCase(ejbJar.properties.getProperty("openejb.cdi.activated"))
>
> Doesn't is better use Boolean.parseBoolean()?
> With parseBoolean it checks if the string argument is not null and is
> equalsIgnoreCase to the "true"
>
> For case like this:
> "true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.cdi.debug",
> "false")
>
> not need to set a default value, for null value the result is false.
> If we want an inverse logic, we need add only "!"
>
> I think better. IMHO. :)
>
> --
> Daniel Cunha (soro)