Similar pattern is use for other fields.
As not a usual committer for this mojo, I followed pattern used.

2013/1/4 Robert Scholte <[email protected]>:
> Hmm, why a Boolean object instead of a boolean primitive if verbose has a
> default value? Now the code is also polluted with null-checks.
>
> Robert
> ________________________________
> From: [email protected]
> To: [email protected]
> Date: Fri, 4 Jan 2013 01:48:07 -0600
> Subject: [mojo-scm] [17823]
> trunk/mojo/versions-maven-plugin/src/main/java/org/codehaus/mojo/
> versions/DisplayDependencyUpdatesMojo.java: [MVERSIONS-206] No longer have
> display-dependency-updates list up-to-date dependencies by default
>
> Revision 17823 Author olamy Date 2013-01-04 01:48:06 -0600 (Fri, 04 Jan
> 2013)
>
> Log Message
>
> [MVERSIONS-206] No longer have display-dependency-updates list up-to-date
> dependencies by default
> Submitted by Glen Mazza.
>
> Modified Paths
>
> trunk/mojo/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java
>
> Diff
>
> Modified:
> trunk/mojo/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java
> (17822 => 17823)
>
> ---
> trunk/mojo/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java
>    2013-01-03
> 09:18:28 UTC (rev 17822)
> +++
> trunk/mojo/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayDependencyUpdatesMojo.java
>    2013-01-04
> 07:48:06 UTC (rev 17823)
> @@ -81,6 +81,15 @@
>       */
>      protected Boolean processDependencies = Boolean.TRUE;
>
> +    /**
> +     * Whether to show additional information such as dependencies that
> +     * do not need updating.  Defaults to false.
> +     *
> +     * @parameter expression="${verbose}" defaultValue="false"
> +     * @since 3.0
> +     */
> +    protected Boolean verbose = Boolean.FALSE;
> +
>      // --------------------- GETTER / SETTER METHODS ---------------------
>
>      /**
> @@ -135,6 +144,12 @@
>          return !Boolean.FALSE.equals( processDependencies );
>      }
>
> +    public boolean isVerbose()
> +    {
> +        // true if true or null
> +        return !Boolean.FALSE.equals( verbose );
> +    }
> +
>  // ------------------------ INTERFACE METHODS ------------------------
>
>  // --------------------- Interface Mojo ---------------------
> @@ -157,19 +172,19 @@
>
>          Set dependencies = new TreeSet( new DependencyComparator() );
>          dependencies.addAll( getProject().getDependencies() );
> -        if ( !Boolean.FALSE.equals( processDependencyManagement ) )
> +        if ( isProcessingDependencyManagement() )
>          {
>              dependencies = removeDependencyManagment( dependencies,
> dependencyManagement );
>          }
>
>          try
>          {
> -            if ( !Boolean.FALSE.equals( processDependencyManagement ) )
> +            if ( isProcessingDependencyManagement() )
>              {
>                  logUpdates( getHelper().lookupDependenciesUpdates(
> dependencyManagement, false ),
>                              "Dependency Management" );
>              }
> -            if ( !Boolean.FALSE.equals( processDependencies ) )
> +            if ( isProcessingDependencies() )
>              {
>                  logUpdates( getHelper().lookupDependenciesUpdates(
> dependencies, false ), "Dependencies" );
>              }
> @@ -227,12 +242,12 @@
>                  t.add( StringUtils.rightPad( left, INFO_PAD_SIZE -
> right.length(), "." ) + right );
>              }
>          }
> -        if ( usingCurrent.isEmpty() && !withUpdates.isEmpty() )
> +        if ( isVerbose() && usingCurrent.isEmpty() &&
> !withUpdates.isEmpty() )
>          {
>              getLog().info( "No dependencies in " + section + " are using
> the newest version." );
>              getLog().info( "" );
>          }
> -        else if ( !usingCurrent.isEmpty() )
> +        else if ( isVerbose() && !usingCurrent.isEmpty() )
>          {
>              getLog().info( "The following dependencies in " + section + "
> are using the newest version:" );
>              i = usingCurrent.iterator();
>
> ________________________________
> To unsubscribe from this list please visit:
> http://xircles.codehaus.org/manage_email



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to