1 22 package org.aspectj.tools.doclets.standard; 23 24 import org.aspectj.tools.ajdoc.Quietable; 25 26 import com.sun.javadoc.RootDoc; 27 import com.sun.tools.doclets.DocletAbortException; 28 import com.sun.tools.doclets.standard.AllClassesFrameWriter; 29 import com.sun.tools.doclets.standard.FrameOutputWriter; 30 import com.sun.tools.doclets.standard.HelpWriter; 31 import com.sun.tools.doclets.standard.PackageIndexFrameWriter; 32 import com.sun.tools.doclets.standard.PackageIndexWriter; 33 import com.sun.tools.doclets.standard.PackageListWriter; 34 import com.sun.tools.doclets.standard.PackagesFileWriter; 35 import com.sun.tools.doclets.standard.SerializedFormWriter; 36 import com.sun.tools.doclets.standard.StylesheetWriter; 37 38 import java.io.IOException ; 39 40 46 public class Standard extends AbstractStandard { 47 private static Standard SINGLETON; public static final Standard getSingleton() { 49 if (null == SINGLETON) { 50 SINGLETON = new Standard(); 51 } 52 return SINGLETON; 53 } 54 private Standard() {} 55 56 public static boolean start(RootDoc root) throws IOException { 57 return start(getSingleton(), root); 58 } 59 60 public ConfigurationStandard getConfiguration() { 61 return (ConfigurationStandard)configuration(); 62 } 63 64 public static void quiet() { 65 if (configuration().root instanceof Quietable) { 66 ((Quietable)configuration().root).quiet(); 67 } 68 } 69 public static void speak() { 70 if (configuration().root instanceof Quietable) { 71 ((Quietable)configuration().root).speak(); 72 } 73 } 74 75 public static class ClassUseMapperPass extends Pass { 76 protected boolean cond() { 77 return cs.classuse; 78 } 79 protected void gen() throws DocletAbortException { 80 ClassUseMapper.generate(root, std.classtree); 81 } 82 public String title() { return "class use mapper"; } 83 } 84 85 public static class TreeWriterPass extends Pass { 86 protected boolean cond() { 87 return cs.createtree; 88 } 89 protected void gen() throws DocletAbortException { 90 TreeWriter.generate(std.classtree); 91 } 92 public String title() { return "tree writer"; } 93 } 94 95 public static class SplitIndexWriterPass extends Pass { 96 protected boolean cond() { 97 return cs.createindex && cs.splitindex; 98 } 99 protected void gen() throws DocletAbortException { 100 SplitIndexWriter.generate(std.indexBuilder(root, false)); 101 } 102 public String title() { return "split index"; } 103 } 104 105 public static class SingleIndexWriterPass extends Pass { 106 protected boolean cond() { 107 return cs.createindex && !cs.splitindex; 108 } 109 protected void gen() throws DocletAbortException { 110 SingleIndexWriter.generate(std.indexBuilder(root, false)); 111 } 112 public String title() { return "single index"; } 113 } 114 115 public static class DeprecatedListWriterPass extends Pass { 116 protected boolean cond() { 117 return !cs.nodeprecatedlist && !cs.nodeprecated; 118 } 119 protected void gen() throws DocletAbortException { 120 DeprecatedListWriter.generate(root); 121 } 122 public String title() { return "deprecated list"; } 123 } 124 125 public static class AllClassesFrameWriterPass extends Pass { 126 protected void gen() throws DocletAbortException { 127 AllClassesFrameWriter.generate(std.indexBuilder(root, true)); 128 } 129 public String title() { return "all classes frame"; } 130 } 131 132 public static class FrameOutputWriterPass extends Pass { 133 protected void gen() throws DocletAbortException { 134 FrameOutputWriter.generate(); 135 } 136 public String title() { return "output frame"; } 137 } 138 139 public static class PackagesFileWriterPass extends Pass { 140 protected void gen() throws DocletAbortException { 141 PackagesFileWriter.generate(); 142 } 143 public String title() { return "packages files"; } 144 } 145 146 public static class PackageIndexWriterPass extends Pass { 147 protected boolean cond(ConfigurationStandard cs) { 148 return cs.createoverview; 149 } 150 protected void gen() throws DocletAbortException { 151 PackageIndexWriter.generate(root); 152 } 153 public String title() { return "package index"; } 154 } 155 156 public static class PackageIndexFrameWriterPass extends Pass { 157 protected boolean cond() { 158 return cs.packages.length > 1; 159 } 160 protected void gen() throws DocletAbortException { 161 PackageIndexFrameWriter.generate(); 162 } 163 public String title() { return "package index frame"; } 164 } 165 166 protected Class [] preGenerationClasses() { 167 return new Class [] { 168 ClassUseMapperPass.class, 169 TreeWriterPass.class, 170 SplitIndexWriterPass.class, 171 SingleIndexWriterPass.class, 172 DeprecatedListWriterPass.class, 173 AllClassesFrameWriterPass.class, 174 FrameOutputWriterPass.class, 175 PackagesFileWriterPass.class, 176 PackageIndexWriterPass.class, 177 PackageIndexFrameWriterPass.class, 178 }; 179 } 180 181 public static class SerializedFormWriterPass extends Pass { 182 protected void gen() throws DocletAbortException { 183 SerializedFormWriter.generate(root); 184 } 185 public String title() { return "serialized form"; } 186 } 187 188 public static class PackageListWriterPass extends Pass { 189 protected void gen() throws DocletAbortException { 190 PackageListWriter.generate(root); 191 } 192 public String title() { return "package list"; } 193 } 194 195 public static class HelpWriterPass extends Pass { 196 protected boolean cond() { 197 return cs.helpfile.length() == 0 && 198 !cs.nohelp; 199 } 200 protected void gen() throws DocletAbortException { 201 HelpWriter.generate(); 202 } 203 public String title() { return "help"; } 204 } 205 206 public static class StylesheetWriterPass extends Pass { 207 protected boolean cond() { 208 return cs.stylesheetfile.length() == 0; 209 } 210 protected void gen() throws DocletAbortException { 211 StylesheetWriter.generate(); 212 } 213 public String title() { return "style sheet"; } 214 } 215 216 217 protected Class [] postGenerationClasses() { 218 return new Class [] { 219 SerializedFormWriterPass.class, 220 PackageListWriterPass.class, 221 HelpWriterPass.class, 222 StylesheetWriterPass.class, 223 }; 224 } 225 226 public static class NoPublicClassesToDocumentCheck extends Check { 227 protected boolean cond() { 228 return root.classes().length == 0; 229 } 230 protected String message() { 231 return "doclet.No_Public_Classes_To_Document"; 232 } 233 } 234 public static class NoNonDeprecatedClassToDocumentCheck extends Check { 235 protected boolean cond() { 236 return cs.topFile.length() == 0; 237 } 238 protected String message() { 239 return "doclet.No_Non_Deprecated_Classes_To_Document"; 240 } 241 } 242 243 protected Class [] checkClasses() { 244 return new Class [] { 245 NoPublicClassesToDocumentCheck.class, 246 NoNonDeprecatedClassToDocumentCheck.class, 247 }; 248 } 249 } 250 251 252 | Popular Tags |