Coverage Report - org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet
 
Classes in this File Line Coverage Branch Coverage Complexity
MojoInheritByDefaultTypeTaglet
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>@inheritByDefault</tt> tag is used to run this Mojo inside of a project
 30  
  * and has annotation parameter.
 31  
  * <br/>
 32  
  * The following is a sample declaration:
 33  
  * <pre>
 34  
  * &#x2f;&#x2a;&#x2a;
 35  
  * &#x20;&#x2a; Dummy Mojo.
 36  
  * &#x20;&#x2a;
 37  
  * &#x20;&#x2a; &#64;inheritByDefault &lt;true|false&gt;
 38  
  * &#x20;&#x2a; ...
 39  
  * &#x20;&#x2a;&#x2f;
 40  
  * public class MyMojo extends AbstractMojo{}
 41  
  * </pre>
 42  
  * To use it, calling the <code>Javadoc</code> tool with the following:
 43  
  * <pre>
 44  
  * javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet'
 45  
  * </pre>
 46  
  * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
 47  
  * <pre>
 48  
  * javadoc ... -tag 'inheritByDefault:t:Is this Mojo inherited'
 49  
  * </pre>
 50  
  *
 51  
  * @see <a href="package-summary.html#package_description">package-summary.html</a>
 52  
  *
 53  
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
 54  
  * @version $Id: MojoInheritByDefaultTypeTaglet.java 1133707 2011-06-09 08:28:59Z stephenc $
 55  
  */
 56  0
 public class MojoInheritByDefaultTypeTaglet
 57  
     extends AbstractMojoTypeTaglet
 58  
 {
 59  
     /** The Javadoc annotation */
 60  
     private static final String NAME = JavaMojoAnnotation.INHERIT_BY_DEFAULT;
 61  
 
 62  
     /** The Javadoc text which will be added to the generated page. */
 63  
     protected static final String HEADER = "Is this Mojo inherited";
 64  
 
 65  
     /**
 66  
      * @return By default, return the string defined in {@linkplain #HEADER}.
 67  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
 68  
      * @see #HEADER
 69  
      */
 70  
     public String getHeader()
 71  
     {
 72  0
         return HEADER;
 73  
     }
 74  
 
 75  
     /**
 76  
      * @return <code>"true|false"</code> since <code>@inheritByDefault</code> has specified values.
 77  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
 78  
      */
 79  
     public String getAllowedValue()
 80  
     {
 81  0
         return "true|false";
 82  
     }
 83  
 
 84  
     /**
 85  
      * @return <code>null</code> since <code>@inheritByDefault</code> has no parameter.
 86  
      * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
 87  
      */
 88  
     public String[] getAllowedParameterNames()
 89  
     {
 90  0
         return null;
 91  
     }
 92  
 
 93  
     /**
 94  
      * @return By default, return the name of this taglet.
 95  
      * @see com.sun.tools.doclets.Taglet#getName()
 96  
      * @see MojoInheritByDefaultTypeTaglet#NAME
 97  
      */
 98  
     public String getName()
 99  
     {
 100  0
         return NAME;
 101  
     }
 102  
 
 103  
     /**
 104  
      * Register this Taglet.
 105  
      *
 106  
      * @param tagletMap the map to register this tag to.
 107  
      */
 108  
     public static void register( Map<String, Taglet> tagletMap )
 109  
     {
 110  0
         MojoInheritByDefaultTypeTaglet tag = new MojoInheritByDefaultTypeTaglet();
 111  0
         Taglet t = tagletMap.get( tag.getName() );
 112  0
         if ( t != null )
 113  
         {
 114  0
             tagletMap.remove( tag.getName() );
 115  
         }
 116  0
         tagletMap.put( tag.getName(), tag );
 117  0
     }
 118  
 }