Coverage Report - org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet
 
Classes in this File Line Coverage Branch Coverage Complexity
MojoExecutionStrategyTypeTaglet
0 %
0/11
0 %
0/2
1,2
 
 1  
 package org.apache.maven.tools.plugin.javadoc;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.Map;
 23  
 
 24  
 import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
 25  
 
 26  
 import com.sun.tools.doclets.Taglet;
 27  
 
 28  
 /**
 29  
  * The <tt>@executionStrategy</tt> tag is used to specify the instantiation strategy and has has parameter.
 30  
  * <br/>
 31  
  * The following is a sample declaration:
 32  
  * <pre>
 33  
  * &#x2f;&#x2a;&#x2a;
 34  
  * &#x20;&#x2a; Dummy Mojo.
 35  
  * &#x20;&#x2a;
 36  
  * &#x20;&#x2a; &#64;executionStrategy &lt;always&gt;
 37  
  * &#x20;&#x2a; ...
 38  
  * &#x20;&#x2a;&#x2f;
 39  
  * public class MyMojo extends AbstractMojo{}
 40  
  * </pre>
 41  
  * To use it, calling the <code>Javadoc</code> tool with the following:
 42  
  * <pre>
 43  
  * javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet'
 44  
  * </pre>
 45  
  * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
 46  
  * <pre>
 47  
  * javadoc ... -tag 'executionStrategy:t:Is executed with the strategy:'
 48  
  * </pre>
 49  
  *
 50  
  * @see <a href="package-summary.html#package_description">package-summary.html</a>
 51  
  *
 52  
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
 53  
  * @version $Id: MojoExecutionStrategyTypeTaglet.java 1133707 2011-06-09 08:28:59Z stephenc $
 54  
  */
 55  0
 public class MojoExecutionStrategyTypeTaglet
 56  
     extends AbstractMojoTypeTaglet
 57  
 {
 58  
     /** The Javadoc annotation */
 59  
     private static final String NAME = JavaMojoAnnotation.EXECUTION_STATEGY;
 60  
 
 61  
     /** The Javadoc text which will be added to the generated page. */
 62  
     protected static final String HEADER = "Is executed with the strategy";
 63  
 
 64  
     /**
 65  
      * @return By default, return the string defined in {@linkplain #HEADER}.
 66  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
 67  
      * @see #HEADER
 68  
      */
 69  
     public String getHeader()
 70  
     {
 71  0
         return HEADER;
 72  
     }
 73  
 
 74  
     /**
 75  
      * @return <code>"*"</code> since <code>@executionStrategy</code> has a value.
 76  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
 77  
      */
 78  
     public String getAllowedValue()
 79  
     {
 80  0
         return "*";
 81  
     }
 82  
 
 83  
     /**
 84  
      * @return <code>null</code> since <code>@executionStrategy</code> has no parameter.
 85  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
 86  
      */
 87  
     public String[] getAllowedParameterNames()
 88  
     {
 89  0
         return null;
 90  
     }
 91  
 
 92  
     /**
 93  
      * @return By default, return the name of this taglet.
 94  
      * @see com.sun.tools.doclets.Taglet#getName()
 95  
      * @see MojoExecutionStrategyTypeTaglet#NAME
 96  
      */
 97  
     public String getName()
 98  
     {
 99  0
         return NAME;
 100  
     }
 101  
 
 102  
     /**
 103  
      * Register this Taglet.
 104  
      *
 105  
      * @param tagletMap the map to register this tag to.
 106  
      */
 107  
     public static void register( Map<String, Taglet> tagletMap )
 108  
     {
 109  0
         MojoExecutionStrategyTypeTaglet tag = new MojoExecutionStrategyTypeTaglet();
 110  0
         Taglet t = tagletMap.get( tag.getName() );
 111  0
         if ( t != null )
 112  
         {
 113  0
             tagletMap.remove( tag.getName() );
 114  
         }
 115  0
         tagletMap.put( tag.getName(), tag );
 116  0
     }
 117  
 }