| package org.apache.maven.tools.plugin.javadoc; |
| |
| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| import java.util.Map; |
| |
| import org.apache.maven.tools.plugin.extractor.javadoc.JavadocMojoAnnotation; |
| |
| import com.sun.tools.doclets.Taglet; |
| |
| /** |
| * The <tt>@requiresDependencyResolution</tt> tag is used to specify the required dependencies in the specified scope |
| * and has parameter. |
| * <br/> |
| * The following is a sample declaration: |
| * <pre> |
| * /** |
| *  * Dummy Mojo. |
| *  * |
| *  * @requiresDependencyResolution <requiredScope> |
| *  * ... |
| *  */ |
| * public class MyMojo extends AbstractMojo{} |
| * </pre> |
| * To use it, calling the <code>Javadoc</code> tool with the following: |
| * <pre> |
| * javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet' |
| * </pre> |
| * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following: |
| * <pre> |
| * javadoc ... -tag 'requiresDependencyResolution:t:Requires the dependencies in this specified scope:' |
| * </pre> |
| * |
| * @see <a href="package-summary.html#package_description">package-summary.html</a> |
| * |
| * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a> |
| * @version $Id$ |
| */ |
| public class MojoRequiresDependencyResolutionTypeTaglet |
| extends AbstractMojoTypeTaglet |
| { |
| /** The Javadoc annotation */ |
| private static final String NAME = JavadocMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION; |
| |
| /** The Javadoc text which will be added to the generated page. */ |
| protected static final String HEADER = "Requires the dependencies in this specified scope"; |
| |
| /** |
| * @return By default, return the string defined in {@linkplain #HEADER}. |
| * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader() |
| * @see #HEADER |
| */ |
| public String getHeader() |
| { |
| return HEADER; |
| } |
| |
| /** |
| * @return <code>"*"</code> since <code>@requiresDependencyResolution</code> has value. |
| * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue() |
| */ |
| public String getAllowedValue() |
| { |
| return "*"; |
| } |
| |
| /** |
| * @return <code>null</code> since <code>@requiresDependencyResolution</code> has no parameter. |
| * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames() |
| */ |
| public String[] getAllowedParameterNames() |
| { |
| return null; |
| } |
| |
| /** |
| * @return By default, return the name of this taglet. |
| * @see com.sun.tools.doclets.Taglet#getName() |
| * @see MojoRequiresDependencyResolutionTypeTaglet#NAME |
| */ |
| public String getName() |
| { |
| return NAME; |
| } |
| |
| /** |
| * Register this Taglet. |
| * |
| * @param tagletMap the map to register this tag to. |
| */ |
| public static void register( Map<String, Taglet> tagletMap ) |
| { |
| MojoRequiresDependencyResolutionTypeTaglet tag = new MojoRequiresDependencyResolutionTypeTaglet(); |
| Taglet t = tagletMap.get( tag.getName() ); |
| if ( t != null ) |
| { |
| tagletMap.remove( tag.getName() ); |
| } |
| tagletMap.put( tag.getName(), tag ); |
| } |
| } |