Documenting classes, and name cleanup

This commit is contained in:
Mark DePristo 2011-08-07 15:17:50 -04:00
parent 1c63d43176
commit 5f8bc3aa8a
3 changed files with 45 additions and 4 deletions

View File

@ -31,29 +31,70 @@ import java.io.*;
import java.util.Set; import java.util.Set;
/** /**
* * Extend this class to provide a documentation handler for GATKdocs
*/ */
public abstract class DocumentedGATKFeatureHandler { public abstract class DocumentedGATKFeatureHandler {
private GATKDoclet doclet; private GATKDoclet doclet;
/**
* @return the javadoc RootDoc of this javadoc run
*/
protected RootDoc getRootDoc() { protected RootDoc getRootDoc() {
return this.doclet.rootDoc; return this.doclet.rootDoc;
} }
/** Set the master doclet driving this handler */
public void setDoclet(GATKDoclet doclet) { public void setDoclet(GATKDoclet doclet) {
this.doclet = doclet; this.doclet = doclet;
} }
/**
* @return the GATKDoclet driving this documentation run
*/
public GATKDoclet getDoclet() { public GATKDoclet getDoclet() {
return doclet; return doclet;
} }
public boolean shouldBeProcessed(ClassDoc doc) { return true; } /**
* Should return false iff this handler wants GATKDoclet to skip documenting
* this ClassDoc.
* @param doc that is being considered for inclusion in the docs
* @return true if the doclet should document ClassDoc doc
*/
public boolean includeInDocs(ClassDoc doc) { return true; }
/**
* Return the flat filename (no paths) that the handler would like the Doclet to
* write out the documentation for ClassDoc doc and its associated Class clazz
* @param doc
* @param clazz
* @return
*/
public String getDestinationFilename(ClassDoc doc, Class clazz) { public String getDestinationFilename(ClassDoc doc, Class clazz) {
return GATKDoclet.htmlFilenameForClass(clazz); return GATKDoclet.htmlFilenameForClass(clazz);
} }
/**
* Return the name of the FreeMarker template we will use to process ClassDoc doc.
*
* Note this is a flat filename relative to settings/helpTemplates in the GATK source tree
* @param doc
* @return
* @throws IOException
*/
public abstract String getTemplateName(ClassDoc doc) throws IOException; public abstract String getTemplateName(ClassDoc doc) throws IOException;
/**
* Actually generate the documentation map associated with toProcess
*
* Can use all to provide references and rootDoc for additional information, if necessary.
* Implementing methods should end with a call to setHandlerContext on toProcess, as in:
*
* toProcess.setHandlerContent(summary, rootMap);
*
* @param rootDoc
* @param toProcess
* @param all
*/
public abstract void processOne(RootDoc rootDoc, GATKDocWorkUnit toProcess, Set<GATKDocWorkUnit> all); public abstract void processOne(RootDoc rootDoc, GATKDocWorkUnit toProcess, Set<GATKDocWorkUnit> all);
} }

View File

@ -117,7 +117,7 @@ public class GATKDoclet {
DocumentedGATKFeature feature = getFeatureForClassDoc(doc); DocumentedGATKFeature feature = getFeatureForClassDoc(doc);
DocumentedGATKFeatureHandler handler = createHandler(doc, feature); DocumentedGATKFeatureHandler handler = createHandler(doc, feature);
if ( handler != null && handler.shouldBeProcessed(doc) ) { if ( handler != null && handler.includeInDocs(doc) ) {
logger.info("Going to generate documentation for class " + doc); logger.info("Going to generate documentation for class " + doc);
String filename = handler.getDestinationFilename(doc, clazz); String filename = handler.getDestinationFilename(doc, clazz);
GATKDocWorkUnit unit = new GATKDocWorkUnit(doc.name(), GATKDocWorkUnit unit = new GATKDocWorkUnit(doc.name(),

View File

@ -51,7 +51,7 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
RootDoc rootDoc; RootDoc rootDoc;
@Override @Override
public boolean shouldBeProcessed(ClassDoc doc) { public boolean includeInDocs(ClassDoc doc) {
return true; return true;
// try { // try {
// Class type = HelpUtils.getClassForDoc(doc); // Class type = HelpUtils.getClassForDoc(doc);