View Javadoc
1   package org.codehaus.plexus.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 com.sun.tools.doclets.Taglet;
25  
26  /**
27   * The <tt>@plexus.configuration</tt> tags are used to mark fields in a class for configuration through
28   * the <tt>components.xml</tt>.
29   * <table class="bodyTable">
30   *   <tbody>
31   *     <tr class="a">
32   *       <td align="left"><b>Parameter</b></td>
33   *       <td align="left"><b>Required</b></td>
34   *       <td align="left"><b>Description</b></td>
35   *     </tr>
36   *     <tr class="b">
37   *       <td align="left">default-value</td>
38   *       <td align="left">Currently</td>
39   *       <td align="left">The default values are currently required for the <tt>&lt;configuration</tt>&gt;
40   *       tag to be written to <tt>components.xml</tt>.</td>
41   *     </tr>
42   *   </tbody>
43   * </table>
44   *
45   * @see <a href="http://plexus.codehaus.org/guides/developer-guide/appendices/javadoc-tags-reference.html">
46   * http://plexus.codehaus.org/guides/developer-guide/appendices/javadoc-tags-reference.html</a>;
47   *
48   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
49   * @version $Id$
50   */
51  public class PlexusConfigurationTaglet
52      extends AbstractPlexusTaglet
53  {
54      private static final String NAME = "plexus.configuration";
55  
56      private static final String HEADER = "Plexus configuration";
57  
58      /** {@inheritDoc} */
59      public String getHeader()
60      {
61          return HEADER;
62      }
63  
64      /** {@inheritDoc} */
65      public String getName()
66      {
67          return NAME;
68      }
69  
70      /** {@inheritDoc} */
71      public boolean inConstructor()
72      {
73          return false;
74      }
75  
76      /** {@inheritDoc} */
77      public boolean inField()
78      {
79          return true;
80      }
81  
82      /** {@inheritDoc} */
83      public boolean inMethod()
84      {
85          return false;
86      }
87  
88      /** {@inheritDoc} */
89      public boolean inOverview()
90      {
91          return false;
92      }
93  
94      /** {@inheritDoc} */
95      public boolean inPackage()
96      {
97          return false;
98      }
99  
100     /** {@inheritDoc} */
101     public boolean inType()
102     {
103         return false;
104     }
105 
106     /** {@inheritDoc} */
107     public boolean isInlineTag()
108     {
109         return false;
110     }
111 
112     /**
113      * Register this Taglet.
114      *
115      * @param tagletMap the map to register this tag to.
116      */
117     public static void register( Map tagletMap )
118     {
119         PlexusConfigurationTaglet tag = new PlexusConfigurationTaglet();
120         Taglet t = (Taglet) tagletMap.get( tag.getName() );
121         if ( t != null )
122         {
123             tagletMap.remove( tag.getName() );
124         }
125         tagletMap.put( tag.getName(), tag );
126     }
127 }