1 22 23 package org.aspectj.tools.ajdoc; 24 import org.aspectj.tools.doclets.standard.AbstractStandard; 25 import org.aspectj.tools.doclets.standard.Standard; 26 27 import com.sun.javadoc.DocErrorReporter; 28 import com.sun.javadoc.RootDoc; 29 30 import java.io.IOException ; 31 import java.util.List ; 32 33 35 public interface DocletProxy { 36 public static final DocletProxy STANDARD 37 = JavadocStandardProxy.SINGLETON; 38 public static final DocletProxy DEFAULT 39 = StandardProxy.SINGLETON; 40 public int optionLength(String arg); 41 public boolean start(RootDoc root) 42 throws IOException ; 43 public boolean validOptions(List options, DocErrorReporter handler) 44 throws IOException ; 45 } 46 47 51 class StandardProxy implements DocletProxy { 52 public static final DocletProxy SINGLETON = new StandardProxy(); 53 private StandardProxy() { } 54 55 56 public int optionLength(String arg) { 57 return Standard.optionLength(arg); 58 } 59 60 public boolean validOptions(List options, DocErrorReporter handler) 61 throws IOException { 62 return AbstractStandard.validOptions(docletOptions(options), handler); 63 } 64 protected String [][] docletOptions(List options) { 66 if ((null == options) || (1 > options.size())) { 67 return new String [][]{}; 68 } 69 Object [] ra = options.toArray(); 70 String [] strs = new String [ra.length]; 71 for (int i = 0; i < ra.length; i++) { 72 strs[i] = (null == ra[i] ? null : ra[i].toString()); 73 } 74 return new String [][] {strs}; 75 } 76 77 78 public boolean start(RootDoc root) throws IOException { 79 return Standard.start(root); 80 } 81 } 83 86 class JavadocStandardProxy implements DocletProxy { 87 public static final DocletProxy SINGLETON = new JavadocStandardProxy(); 88 private JavadocStandardProxy() { } 89 90 91 public int optionLength(String arg) { 92 return com.sun.tools.doclets.standard.Standard.optionLength(arg); 93 } 94 95 public boolean validOptions(List options, DocErrorReporter handler) 96 throws IOException { 97 return com.sun.tools.doclets.standard.Standard.validOptions(docletOptions(options), handler); 98 } 99 protected String [][] docletOptions(List options) { 101 if ((null == options) || (1 > options.size())) { 102 return new String [][]{}; 103 } 104 Object [] ra = options.toArray(); 105 String [] strs = new String [ra.length]; 106 for (int i = 0; i < ra.length; i++) { 107 strs[i] = (null == ra[i] ? null : ra[i].toString()); 108 } 109 return new String [][] {strs}; 110 } 111 112 113 public boolean start(RootDoc root) throws IOException { 114 return com.sun.tools.doclets.standard.Standard.start(root); 115 } 116 } 118 146 | Popular Tags |