Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MojoExecuteTypeTaglet |
|
| 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>@execute</tt> tag is used to reference the invocation way of the Mojo and has parameters. | |
30 | * <br/> | |
31 | * The following is a sample declaration: | |
32 | * <pre> | |
33 | * /** | |
34 | *  * Dummy Mojo. | |
35 | *  * | |
36 | *  * @execute phase="..." lifecycle="..." | |
37 | *  * <OR> | |
38 | *  * @execute phase="..." | |
39 | *  * <OR> | |
40 | *  * @execute goal="..." | |
41 | *  * ... | |
42 | *  */ | |
43 | * public class MyMojo extends AbstractMojo{} | |
44 | * </pre> | |
45 | * To use it, calling the <code>Javadoc</code> tool with the following: | |
46 | * <pre> | |
47 | * javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet' | |
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: MojoExecuteTypeTaglet.java 1133707 2011-06-09 08:28:59Z stephenc $ | |
54 | */ | |
55 | 0 | public class MojoExecuteTypeTaglet |
56 | extends AbstractMojoTypeTaglet | |
57 | { | |
58 | /** The Javadoc annotation */ | |
59 | private static final String NAME = JavaMojoAnnotation.EXECUTE; | |
60 | ||
61 | 0 | private static final String[] PARAMETERS_NAME = { |
62 | JavaMojoAnnotation.EXECUTE_PHASE, | |
63 | JavaMojoAnnotation.EXECUTE_LIFECYCLE, | |
64 | JavaMojoAnnotation.EXECUTE_GOAL }; | |
65 | ||
66 | /** The Javadoc text which will be added to the generated page. */ | |
67 | protected static final String HEADER = "Is defined to be executed in"; | |
68 | ||
69 | /** | |
70 | * @return By default, return the string defined in {@linkplain #HEADER}. | |
71 | * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader() | |
72 | * @see #HEADER | |
73 | */ | |
74 | public String getHeader() | |
75 | { | |
76 | 0 | return HEADER; |
77 | } | |
78 | ||
79 | /** | |
80 | * @return <code>null</code> since <code>@execute</code> has no value. | |
81 | * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue() | |
82 | */ | |
83 | public String getAllowedValue() | |
84 | { | |
85 | 0 | return null; |
86 | } | |
87 | ||
88 | /** | |
89 | * @return <code>MojoExecuteTypeTaglet#PARAMETERS_NAME</code> since <code>@execute</code> has parameters. | |
90 | * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames() | |
91 | * @see #PARAMETERS_NAME | |
92 | */ | |
93 | public String[] getAllowedParameterNames() | |
94 | { | |
95 | 0 | return PARAMETERS_NAME; |
96 | } | |
97 | ||
98 | /** | |
99 | * @return By default, return the name of this taglet. | |
100 | * @see com.sun.tools.doclets.Taglet#getName() | |
101 | * @see MojoExecuteTypeTaglet#NAME | |
102 | */ | |
103 | public String getName() | |
104 | { | |
105 | 0 | return NAME; |
106 | } | |
107 | ||
108 | /** | |
109 | * Register this Taglet. | |
110 | * | |
111 | * @param tagletMap the map to register this tag to. | |
112 | */ | |
113 | public static void register( Map<String, Taglet> tagletMap ) | |
114 | { | |
115 | 0 | MojoExecuteTypeTaglet tag = new MojoExecuteTypeTaglet(); |
116 | 0 | Taglet t = tagletMap.get( tag.getName() ); |
117 | 0 | if ( t != null ) |
118 | { | |
119 | 0 | tagletMap.remove( tag.getName() ); |
120 | } | |
121 | 0 | tagletMap.put( tag.getName(), tag ); |
122 | 0 | } |
123 | } |