View Javadoc

1   package net.sf.jameleon.taglet;
2   
3   import java.util.Map;
4   
5   import com.sun.tools.doclets.Taglet;
6   
7   public abstract class AbstractJameleonTaglet implements Taglet{
8   
9       protected String name;
10  
11      protected boolean inField;
12      protected boolean inConstructor;
13      protected boolean inMethod;
14      protected boolean inOverview;
15      protected boolean inPackage;
16      protected boolean inType;
17      protected boolean isInlineTag;
18  
19      
20      public String getName(){
21          return name;
22      }
23  
24      public boolean inField(){
25          return inField;
26      }
27  
28      public boolean inConstructor(){
29          return inConstructor;
30      }
31  
32      public boolean inMethod(){
33          return inMethod;
34      }
35  
36      public boolean inOverview(){
37          return inOverview;
38      }
39  
40      public boolean inPackage(){
41          return inPackage;
42      }
43  
44      public boolean inType(){
45          return inType;
46      }
47  
48      public boolean isInlineTag(){
49          return isInlineTag;
50      }
51  
52      protected static void doRegister(Map tagletMap, Taglet tag){
53          Taglet t = (Taglet) tagletMap.get(tag.getName());
54          if (t != null) {
55              tagletMap.remove(t.getName());
56          }
57          tagletMap.put(tag.getName(), tag);
58      }
59  
60      protected String getValueFromAttribute(String tagText, String attrName){
61          String tagName = null;
62          final String TAG_NAME_ATTR = attrName+"=\"";
63          int index = tagText.indexOf(TAG_NAME_ATTR);
64          int start = index+TAG_NAME_ATTR.length();
65          int end = tagText.indexOf("\"",index+TAG_NAME_ATTR.length());
66          if (index > -1) {
67              tagName = tagText.substring(start, end);
68          }
69          return tagName;
70      }
71  }
72