Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MojoAggregatorTypeTaglet |
|
| 1.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>@aggregator</tt> tag is used to aggregate the Maven project and its child modules and | |
30 | * has no parameter. | |
31 | * <br/> | |
32 | * The following is a sample declaration: | |
33 | * <pre> | |
34 | * /** | |
35 | *  * Dummy Mojo. | |
36 | *  * | |
37 | *  * @aggregator | |
38 | *  * ... | |
39 | *  */ | |
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.MojoAggregatorTypeTaglet' | |
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 'aggregator:t:Aggregates the Maven project and its child modules.' | |
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: MojoAggregatorTypeTaglet.java 1133707 2011-06-09 08:28:59Z stephenc $ | |
55 | */ | |
56 | 0 | public class MojoAggregatorTypeTaglet |
57 | extends AbstractMojoTypeTaglet | |
58 | { | |
59 | /** The Javadoc annotation */ | |
60 | private static final String NAME = JavaMojoAnnotation.AGGREGATOR; | |
61 | ||
62 | /** The Javadoc text which will be added to the generated page */ | |
63 | protected static final String HEADER = "Aggregates the Maven project and its child modules."; | |
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>null</code> since <code>@aggregator</code> has no value. | |
77 | * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue() | |
78 | */ | |
79 | public String getAllowedValue() | |
80 | { | |
81 | 0 | return null; |
82 | } | |
83 | ||
84 | /** | |
85 | * @return <code>null</code> since <code>@aggregator</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 MojoAggregatorTypeTaglet#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 | MojoAggregatorTypeTaglet tag = new MojoAggregatorTypeTaglet(); |
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 | } |