incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r797015 - /incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java
Date Thu, 23 Jul 2009 11:09:32 GMT
Author: spoole
Date: Thu Jul 23 11:09:31 2009
New Revision: 797015

URL: http://svn.apache.org/viewvc?rev=797015&view=rev
Log:
updated xml javadoc ant task to include method summary info

Modified:
    incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java

Modified: incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java?rev=797015&r1=797014&r2=797015&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.anttasks/src/main/java/org/apache/kato/anttasks/xmlgen/XMLWriter.java
Thu Jul 23 11:09:31 2009
@@ -21,6 +21,7 @@
 import com.sun.javadoc.PackageDoc;
 import com.sun.javadoc.ParamTag;
 import com.sun.javadoc.Parameter;
+import com.sun.javadoc.SeeTag;
 import com.sun.javadoc.Tag;
 import com.sun.javadoc.Type;
 
@@ -72,9 +73,21 @@
 		for(MethodDoc m:c.methods()) {
 			writeMethod(m);
 		}
+		
+		SeeTag[] seetags=c.seeTags();
+		writeSeeTags(seetags);
+		
+		writeElement("extends",c.superclass().qualifiedName());
+		
+		
+		
 		write("</class>");
 		
 	}
+	private void writeElement(String elementName, String text) {
+		write("<"+elementName+">"+text+"</"+elementName+">");
+		
+	}
 	private void writeField(FieldDoc f) throws IOException {
 		write("<field name=\""+f.name()+"\" value=\""+f.constantValueExpression()+"\" >");
 		writeComment(f.commentText());
@@ -93,10 +106,28 @@
 		Type t=m.returnType();
 		writeType("returntype",t);
 		write("<modifiers>"+m.modifiers()+"</modifiers>");
-		
+		writeSummary(m.firstSentenceTags());
 		writeComment(m.commentText());
+		
+		
+		SeeTag[] seetags=m.seeTags();
+		writeSeeTags(seetags);
+		
 		write("</method>");
 		
+	}
+	private void writeSeeTags(SeeTag[] seetags) {
+		if(seetags==null || seetags.length==0) return;
+		write("<seerefs>");
+		for(SeeTag seetag:seetags) {
+			write(seetag);
+		}
+		write("</seerefs>");
+		
+	}
+	private void write(SeeTag seetag) {
+	
+		write("<see>"+seetag.text()+"</see>");
 		
 	}
 	private void write(ParamTag[] parameters) {
@@ -197,17 +228,9 @@
 				break;
 			case Node.ELEMENT_NODE :
 				String name=n.getNodeName();
-				if(name.equals("BR")) name="html:br";
-				if(name.equals("H1")) name="db:sect2";
-				if(name.equals("H2")) name="db:sect3";
-				if(name.equals("H3")) name="db:sect4";
-				if(name.equals("H4")) name="db:sect5";
-				if(name.equals("P")) name="db:para";
-				if(name.equals("UL")) name="db:itemizedlist";
-				if(name.equals("OL")) name="db:orderedlist";
-				if(name.equals("LI")) name="db:listitem"; 
-				if(name.equals("A")) name="db:link";
-				if(name.equals("PRE")) name="db:programlisting";
+				name=mapNameToDocBook(name);
+				
+			
 				
 				write("<"+name+">");
 				if(n.hasChildNodes()) {
@@ -227,6 +250,20 @@
 		}
 		
 	}
+	private String mapNameToDocBook(String name) {
+		if(name.equals("BR")) name="html:br";
+		if(name.equals("H1")) name="db:sect2";
+		if(name.equals("H2")) name="db:sect3";
+		if(name.equals("H3")) name="db:sect4";
+		if(name.equals("H4")) name="db:sect5";
+		if(name.equals("P")) name="db:para";
+		if(name.equals("UL")) name="db:itemizedlist";
+		if(name.equals("OL")) name="db:orderedlist";
+		if(name.equals("LI")) name="db:listitem"; 
+		if(name.equals("A")) name="db:link";
+		if(name.equals("PRE")) name="db:programlisting";
+		return name;
+	}
 	public void writeInterface(ClassDoc c) throws IOException {
 		write("<interface name=\""+c.name()+"\">");
 		Tag[] tags=c.firstSentenceTags();
@@ -235,6 +272,10 @@
 		for(MethodDoc m:c.methods()) {
 			writeMethod(m);
 		}
+		ClassDoc parent=c.superclass();
+		if(parent!=null) {
+			writeElement("extends",parent.qualifiedName());
+		}
 		write("</interface>");
 		
 	}



Mime
View raw message