001package org.apache.maven.tools.plugin.javadoc; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.Map; 023 024import org.apache.maven.tools.plugin.extractor.javadoc.JavadocMojoAnnotation; 025 026import com.sun.tools.doclets.Taglet; 027 028/** 029 * The <tt>@aggregator</tt> tag is used to aggregate the Maven project and its child modules and 030 * has no parameter. 031 * <br/> 032 * The following is a sample declaration: 033 * <pre> 034 * /** 035 *  * Dummy Mojo. 036 *  * 037 *  * @aggregator 038 *  * ... 039 *  */ 040 * public class MyMojo extends AbstractMojo{} 041 * </pre> 042 * To use it, calling the <code>Javadoc</code> tool with the following: 043 * <pre> 044 * javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet' 045 * </pre> 046 * <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following: 047 * <pre> 048 * javadoc ... -tag 'aggregator:t:Aggregates the Maven project and its child modules.' 049 * </pre> 050 * 051 * @see <a href="package-summary.html#package_description">package-summary.html</a> 052 * 053 * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a> 054 * @version $Id: MojoAggregatorTypeTaglet.html 995996 2016-08-26 22:31:42Z rfscholte $ 055 */ 056public class MojoAggregatorTypeTaglet 057 extends AbstractMojoTypeTaglet 058{ 059 /** The Javadoc annotation */ 060 private static final String NAME = JavadocMojoAnnotation.AGGREGATOR; 061 062 /** The Javadoc text which will be added to the generated page */ 063 protected static final String HEADER = "Aggregates the Maven project and its child modules."; 064 065 /** 066 * @return By default, return the string defined in {@linkplain #HEADER}. 067 * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader() 068 * @see #HEADER 069 */ 070 public String getHeader() 071 { 072 return HEADER; 073 } 074 075 /** 076 * @return <code>null</code> since <code>@aggregator</code> has no value. 077 * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue() 078 */ 079 public String getAllowedValue() 080 { 081 return null; 082 } 083 084 /** 085 * @return <code>null</code> since <code>@aggregator</code> has no parameter. 086 * @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames() 087 */ 088 public String[] getAllowedParameterNames() 089 { 090 return null; 091 } 092 093 /** 094 * @return By default, return the name of this taglet. 095 * @see com.sun.tools.doclets.Taglet#getName() 096 * @see MojoAggregatorTypeTaglet#NAME 097 */ 098 public String getName() 099 { 100 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 MojoAggregatorTypeTaglet tag = new MojoAggregatorTypeTaglet(); 111 Taglet t = tagletMap.get( tag.getName() ); 112 if ( t != null ) 113 { 114 tagletMap.remove( tag.getName() ); 115 } 116 tagletMap.put( tag.getName(), tag ); 117 } 118}