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