User: ara_e_w
Date: 02/02/17 13:12:08
Modified: src/xjavadoc ClassDump.java NoSourceClass.java
Primitive.java UnknownClass.java XClass.java
XExecutableMember.java XJavaDocTest.java
Added: src/xjavadoc AbstractClass.java XField.java
XProgramElement.java
Log:
- more compatible with doclet api
- modifiers scanning for top level classes
- ....!
Revision Changes Path
1.3 +25 -5 xjavadoc/src/xjavadoc/ClassDump.java
Index: ClassDump.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/ClassDump.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- ClassDump.java 11 Feb 2002 14:11:57 -0000 1.2
+++ ClassDump.java 17 Feb 2002 21:12:08 -0000 1.3
@@ -43,7 +43,7 @@
/**
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Feb 2, 2002
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ClassDump extends Task {
@@ -107,10 +107,13 @@
public void execute() throws BuildException {
try {
- XJavaDoc _xj = new XJavaDoc(dir, new
String[]{className.replace('.', File.separatorChar) + ".java"}, null);
- _xj.scan();
+ XJavaDoc.getInstance().setDir(dir);
+ XJavaDoc.getInstance().setFiles(new
String[]{className.replace('.', File.separatorChar) + ".java"});
+ XJavaDoc.getInstance().setDocletClass(null);
- XClass clazz = _xj.getXClass(className);
+ XJavaDoc.getInstance().scan();
+
+ XClass clazz = XJavaDoc.getInstance().getXClass(className);
dumpClass(clazz);
} catch (XJavaDocException e) {
e.printStackTrace();
@@ -127,7 +130,6 @@
* @todo-javadoc Write javadocs for return value
*/
public void dumpClass(XClass clazz) {
- StringBuffer str = new StringBuffer();
System.out.println("Dumping class:" + clazz.name());
@@ -139,6 +141,7 @@
System.out.println("name=" + clazz.name());
System.out.println("qualifiedName=" + clazz.qualifiedName());
System.out.println("containingPackage=" + clazz.containingPackage());
+ System.out.println("modifiers=" + clazz.modifiers());
System.out.println("superclass=" + clazz.superclass().qualifiedName());
@@ -162,5 +165,22 @@
}
dumpClass(clazz.superclass());
+ }
+
+
+ /**
+ * The main program for the ClassDump class
+ *
+ * @param args Describe the command line arguments
+ * @todo-javadoc Describe the command line arguments
+ */
+ public static void main(String[] args) {
+
+ String dir = args[0];
+ String className = args[1];
+
+ ClassDump class_dump = new ClassDump();
+ class_dump.setDir(new File(dir));
+ class_dump.setClassName(className);
}
}
1.5 +7 -54 xjavadoc/src/xjavadoc/NoSourceClass.java
Index: NoSourceClass.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/NoSourceClass.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- NoSourceClass.java 13 Jan 2002 16:37:34 -0000 1.4
+++ NoSourceClass.java 17 Feb 2002 21:12:08 -0000 1.5
@@ -12,7 +12,7 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * - Neither the name of the BEKK Consulting nor the names of its
+ * - Neither the name of BEKK Consulting nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
@@ -35,6 +35,8 @@
*/
package xjavadoc;
+import xjavadoc.ast.Token;
+
/**
* Describe what this class does
*
@@ -42,25 +44,12 @@
* @created 3. januar 2002
* @todo-javadoc Write javadocs
*/
-public abstract class NoSourceClass extends XClass {
+public abstract class NoSourceClass extends AbstractClass {
/**
* @todo-javadoc Describe the field
*/
- protected final XJavaDoc _xJavaDoc;
-
- /**
- * @todo-javadoc Describe the field
- */
- private String _qualifiedName;
- /**
- * @todo-javadoc Describe the field
- */
- private String _name;
- /**
- * @todo-javadoc Describe the field
- */
- private XPackage _xpackage;
+ protected XPackage _xpackage;
/**
* Get static reference to Log4J Logger
@@ -69,18 +58,6 @@
/**
- * Describe what the NoSourceClass constructor does
- *
- * @param xJavaDoc Describe what the parameter does
- * @todo-javadoc Write javadocs for constructor
- * @todo-javadoc Write javadocs for method parameter
- */
- protected NoSourceClass(XJavaDoc xJavaDoc) {
- _xJavaDoc = xJavaDoc;
- }
-
-
- /**
* Describe what the method does
*
* @return Describe the return value
@@ -178,30 +155,6 @@
/**
- * Describe what the method does
- *
- * @return Describe the return value
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for return value
- */
- public String name() {
- return _name;
- }
-
-
- /**
- * Describe what the method does
- *
- * @return Describe the return value
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for return value
- */
- public String qualifiedName() {
- return _qualifiedName;
- }
-
-
- /**
* Sets the QualifiedName attribute of the NoSourceClass object
*
* @param qualifiedName The new QualifiedName value
@@ -213,12 +166,12 @@
if (lastDot == -1) {
// default package;
_name = qualifiedName;
- _xpackage = _xJavaDoc.addPackageMaybe("");
+ _xpackage = XJavaDoc.getInstance().addPackageMaybe("");
}
else {
_name = qualifiedName.substring(lastDot + 1);
String packageName = qualifiedName.substring(0, lastDot);
- _xpackage = _xJavaDoc.addPackageMaybe(packageName);
+ _xpackage =
XJavaDoc.getInstance().addPackageMaybe(packageName);
}
_log.debug(getClass().getName() + ":" + qualifiedName());
_xpackage.addClass(this);
1.3 +60 -19 xjavadoc/src/xjavadoc/Primitive.java
Index: Primitive.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/Primitive.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- Primitive.java 18 Dec 2001 23:26:29 -0000 1.2
+++ Primitive.java 17 Feb 2002 21:12:08 -0000 1.3
@@ -1,29 +1,70 @@
+/*
+ * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of BEKK Consulting nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Change log
+ *
+ */
package xjavadoc;
/**
* This class represents primitive types
+ *
+ * @author Ara Abrahamian
+ * @created February 17, 2002
*/
public class Primitive extends NoSourceClass {
- private final String _name;
+
+ /**
+ * Describe what the Primitive constructor does
+ *
+ * @param name Describe what the parameter does
+ * @todo-javadoc Write javadocs for constructor
+ * @todo-javadoc Write javadocs for method parameter
+ */
Primitive( String name ) {
- super( null );
- _name = name;
- }
- public XPackage containingPackage() {
- return null;
- }
- public String name() {
- return _name;
+ _name = name;
+ _qualifiedName = name;
+ _xpackage = null;
}
- public String qualifiedName() {
- return _name;
- }
+ /**
+ * Gets the Abstract attribute of the Primitive object
+ *
+ * @return The Abstract value
+ */
public boolean isAbstract() {
return false;
}
}
-
1.5 +59 -9 xjavadoc/src/xjavadoc/UnknownClass.java
Index: UnknownClass.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/UnknownClass.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- UnknownClass.java 18 Dec 2001 23:26:29 -0000 1.4
+++ UnknownClass.java 17 Feb 2002 21:12:08 -0000 1.5
@@ -1,21 +1,71 @@
+/*
+ * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of BEKK Consulting nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Change log
+ *
+ */
package xjavadoc;
+import xjavadoc.ast.Token;
+
/**
- * This implementation of XClass is used for classes that
- * can't be resolved from either source or classpath (binary classes).
- * It's useful for XDoclet, especially when classes refer to classes
- * that are going to be generated by XDoclet.
+ * This implementation of XClass is used for classes that can't be resolved from
+ * either source or classpath (binary classes). It's useful for XDoclet,
+ * especially when classes refer to classes that are going to be generated by
+ * XDoclet.
+ *
+ * @author Ara Abrahamian
+ * @created February 17, 2002
*/
public class UnknownClass extends NoSourceClass {
- public UnknownClass( XJavaDoc xJavaDoc, String qualifiedName ) {
- super(xJavaDoc);
+ /**
+ * Describe what the UnknownClass constructor does
+ *
+ * @param qualifiedName Describe what the parameter does
+ * @todo-javadoc Write javadocs for constructor
+ * @todo-javadoc Write javadocs for method parameter
+ */
+ public UnknownClass(String qualifiedName) {
setQualifiedName( qualifiedName );
}
+
/**
- * We can't really assume anything about whether an unknown class is abstract
or not.
- * However, we need to implement the method, so we'll be defensive and assume
it's abstract
+ * We can't really assume anything about whether an unknown class is abstract
+ * or not. However, we need to implement the method, so we'll be defensive and
+ * assume it's abstract
+ *
+ * @return The Abstract value
*/
public boolean isAbstract() {
return false;
1.10 +26 -91 xjavadoc/src/xjavadoc/XClass.java
Index: XClass.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XClass.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- XClass.java 1 Feb 2002 21:46:32 -0000 1.9
+++ XClass.java 17 Feb 2002 21:12:08 -0000 1.10
@@ -44,42 +44,16 @@
* @author Aslak Helles�y
* @created 3. januar 2002
*/
-public abstract class XClass implements Documented, Comparable {
-
- /**
- * @todo-javadoc Describe the field
- */
- public final static XClass[] ZERO_CLASSES = new XClass[0];
- /**
- * @todo-javadoc Describe the field
- */
- public final static XMethod[] ZERO_METHODS = new XMethod[0];
- /**
- * @todo-javadoc Describe the field
- */
- public final static XConstructor[] ZERO_CONSTRUCTORS = new XConstructor[0];
- /**
- * @todo-javadoc Describe the field
- */
- public final static XPackage[] ZERO_PACKAGES = new XPackage[0];
- /**
- * Get static reference to Log4J Logger
- */
- private static org.apache.log4j.Category _log =
org.apache.log4j.Category.getInstance(XClass.class.getName());
-
+public interface XClass extends XProgramElement, Comparable {
/**
* Gets the Method attribute of the XClass object
*
* @param method Describe what the parameter does
* @return The Method value
- * @exception XJavaDocException Describe the exception
* @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for exception
*/
- public XMethod getMethod(String method) throws XJavaDocException {
- throw new UnsupportedOperationException(getClass().getName());
- }
+ public XMethod getMethod(String method);
/**
@@ -98,9 +72,7 @@
* @return The A value
* @todo-javadoc Write javadocs for method parameter
*/
- public boolean isA(String classOrInterfaceName) {
- return subclassOf(classOrInterfaceName) ||
implementsInterface(classOrInterfaceName);
- }
+ public boolean isA(String classOrInterfaceName);
/**
@@ -114,9 +86,7 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String save(File rootDir) throws IOException {
- throw new UnsupportedOperationException(getClass().getName());
- }
+ public String save(File rootDir) throws IOException;
/**
@@ -126,7 +96,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XClass superclass();
+ public XClass superclass();
/**
@@ -136,7 +106,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XClass[] interfaces();
+ public XClass[] interfaces();
/**
@@ -146,7 +116,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XClass[] importedClasses();
+ public XClass[] importedClasses();
/**
@@ -156,7 +126,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract String name();
+ public String name();
/**
@@ -166,7 +136,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract String qualifiedName();
+ public String qualifiedName();
/**
@@ -176,7 +146,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XMethod[] methods();
+ public XMethod[] methods();
/**
@@ -186,7 +156,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XConstructor[] constructors();
+ public XConstructor[] constructors();
/**
@@ -196,7 +166,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XPackage containingPackage();
+ public XPackage containingPackage();
/**
@@ -206,7 +176,7 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XPackage[] importedPackages();
+ public XPackage[] importedPackages();
/**
@@ -216,79 +186,44 @@
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
- public abstract XDoc doc();
+ public XDoc doc();
/**
- * Added this method for middlegen's TypeConstraint
+ * Get modifiers string.
*
- * @param className Describe what the parameter does
* @return Describe the return value
- * @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
- public boolean subclassOf(String className) {
- boolean result = false;
- XClass superclass = this;
- while (superclass != null) {
- if (superclass.qualifiedName().equals(className)) {
- result = true;
- break;
- }
- XClass superclass2 = superclass.superclass();
- if (superclass2 != null) {
- _log.debug(superclass.qualifiedName() + " SUPERCLASS
IS " + superclass2.qualifiedName());
- }
- superclass = superclass2;
- }
- return result;
- }
+ public String modifiers();
/**
- * Added this method for middlegen's TypeConstraint
+ * Sets the Modifiers attribute of the XClass object
*
- * @param interfaceName Describe what the parameter does
- * @return Describe the return value
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for return value
+ * @param modifiers The new Modifiers value
*/
- public boolean implementsInterface(String interfaceName) {
- boolean result = false;
- XClass[] interfaces = interfaces();
- for (int i = interfaces.length - 1; i >= 0; i--) {
- _log.debug(qualifiedName() + " IMPLEMENTS " +
interfaces[i].qualifiedName());
- if (interfaces[i].qualifiedName().equals(interfaceName)) {
- result = true;
- break;
- }
- }
- return result;
- }
+ public void setModifiers(String modifiers);
/**
- * Describe what the method does
+ * Added this method for middlegen's TypeConstraint
*
- * @param o Describe what the parameter does
+ * @param className Describe what the parameter does
* @return Describe the return value
- * @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
- public int compareTo(Object o) {
- return name().compareTo(((XClass)o).name());
- }
+ public boolean subclassOf(String className);
/**
- * Describe what the method does
+ * Added this method for middlegen's TypeConstraint
*
+ * @param interfaceName Describe what the parameter does
* @return Describe the return value
- * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
- public String toString() {
- return qualifiedName();
- }
+ public boolean implementsInterface(String interfaceName);
}
1.5 +99 -7 xjavadoc/src/xjavadoc/XExecutableMember.java
Index: XExecutableMember.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XExecutableMember.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- XExecutableMember.java 21 Dec 2001 11:53:09 -0000 1.4
+++ XExecutableMember.java 17 Feb 2002 21:12:08 -0000 1.5
@@ -1,12 +1,104 @@
+/*
+ * Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of BEKK Consulting nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/*
+ * Change log
+ *
+ */
package xjavadoc;
-public interface XExecutableMember extends Documented {
+/**
+ * Describe what this class does
+ *
+ * @author Ara Abrahamian
+ * @created February 17, 2002
+ * @todo-javadoc Write javadocs for interface
+ */
+public interface XExecutableMember extends XProgramElement {
+ /**
+ * Describe what the method does
+ *
+ * @return Describe the return value
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for return value
+ */
public abstract String name();
+
+
+ /**
+ * Describe what the method does
+ *
+ * @return Describe the return value
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for return value
+ */
public abstract XParameter[] parameters();
+
+
+ /**
+ * Describe what the method does
+ *
+ * @return Describe the return value
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for return value
+ */
public abstract XClass[] thrownExceptions();
+
+
+ /**
+ * Describe what the method does
+ *
+ * @return Describe the return value
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for return value
+ */
public abstract XClass containingClass();
+
+
+ /**
+ * Describe what the method does
+ *
+ * @return Describe the return value
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for return value
+ */
public abstract XDoc doc();
+
+
+ /**
+ * Gets the Constructor attribute of the XExecutableMember object
+ *
+ * @return The Constructor value
+ */
public boolean isConstructor();
}
1.8 +9 -10 xjavadoc/src/xjavadoc/XJavaDocTest.java
Index: XJavaDocTest.java
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/XJavaDocTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- XJavaDocTest.java 11 Feb 2002 14:11:57 -0000 1.7
+++ XJavaDocTest.java 17 Feb 2002 21:12:08 -0000 1.8
@@ -55,10 +55,6 @@
/**
* @todo-javadoc Describe the field
*/
- private XJavaDoc _xj;
- /**
- * @todo-javadoc Describe the field
- */
private String[] _files;
@@ -85,8 +81,11 @@
_files = Util.getJavaFiles(dir);
Arrays.sort(_files);
- _xj = new XJavaDoc(dir, _files, null);
- _xj.scan();
+ XJavaDoc.getInstance().setDir(dir);
+ XJavaDoc.getInstance().setFiles(_files);
+ XJavaDoc.getInstance().setDocletClass(null);
+
+ XJavaDoc.getInstance().scan();
}
@@ -95,7 +94,7 @@
*/
public void testReadHello() {
- XClass clazz = _xj.getXClass("Hello");
+ XClass clazz = XJavaDoc.getInstance().getXClass("Hello");
XDoc doc = clazz.doc();
assertEquals("Bla bla yadda yadda", doc.firstSentence());
XTag[] tags = doc.tags();
@@ -135,7 +134,7 @@
" * rules \n" +
" indeed \n" +
" */";
- XClass clazz = _xj.getXClass("Hello");
+ XClass clazz = XJavaDoc.getInstance().getXClass("Hello");
XDoc doc = clazz.doc();
doc.setJavadoc(newJavadoc);
@@ -221,7 +220,7 @@
*/
public void testAddCommentToUncommentedClass() throws Exception {
XClass clazz;
- clazz = _xj.updateClassTag("Hello", "here", "is", "a tag for ya", 0);
+ clazz = XJavaDoc.getInstance().updateClassTag("Hello", "here", "is",
"a tag for ya", 0);
File testDir = new
File("build/junit/testAddCommentToUncommentedClass");
String fileName = clazz.save(testDir);
}
@@ -235,7 +234,7 @@
*/
public void testThisFailsInXDocletGui() throws Exception {
XClass clazz;
- clazz = _xj.updateClassTag("test.ejb.cmr.CountryBean", "ejb:bean",
"type", "BMP", 0);
+ clazz =
XJavaDoc.getInstance().updateClassTag("test.ejb.cmr.CountryBean", "ejb:bean", "type",
"BMP", 0);
File testDir = new File("build/junit/testThisFailsInXDocletGui");
String fileName = clazz.save(testDir);
}
1.1 xjavadoc/src/xjavadoc/AbstractClass.java
Index: AbstractClass.java
===================================================================
/*
* Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of BEKK Consulting nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Change log
*
*/
package xjavadoc;
import xjavadoc.XField;
import xjavadoc.ast.Token;
import xjavadoc.parser.AbstractProgramElement;
import java.io.IOException;
import java.io.File;
/**
* Describe what this class does
*
* @author Ara Abrahamian
* @created February 17, 2002
* @todo-javadoc Write javadocs
*/
public abstract class AbstractClass extends AbstractProgramElement implements XClass
{
/**
* @todo-javadoc Describe the field
*/
public final static XClass[] ZERO_CLASSES = new XClass[0];
/**
* @todo-javadoc Describe the field
*/
public final static XMethod[] ZERO_METHODS = new XMethod[0];
/**
* @todo-javadoc Describe the field
*/
public final static XConstructor[] ZERO_CONSTRUCTORS = new XConstructor[0];
/**
* @todo-javadoc Describe the field
*/
public final static XField[] ZERO_FIELDS = new XField[0];
/**
* @todo-javadoc Describe the field
*/
public final static XPackage[] ZERO_PACKAGES = new XPackage[0];
/**
* Get static reference to Log4J Logger
*/
private static org.apache.log4j.Category _log =
org.apache.log4j.Category.getInstance(XClass.class.getName());
/**
* Gets the Method attribute of the XClass object
*
* @param method Describe what the parameter does
* @return The Method value
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
public XMethod getMethod(String method) {
throw new UnsupportedOperationException(getClass().getName());
}
/**
* Returns true if we are subclass or implement the class/interface with the
* name classOrInterfaceName
*
* @param classOrInterfaceName Describe what the parameter does
* @return The A value
* @todo-javadoc Write javadocs for method parameter
*/
public boolean isA(String classOrInterfaceName) {
return subclassOf(classOrInterfaceName) ||
implementsInterface(classOrInterfaceName);
}
/**
* Describe what the method does
*
* @param rootDir Describe what the parameter does
* @return Describe the return value
* @exception IOException Describe the exception
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
public String save(File rootDir) throws IOException {
throw new UnsupportedOperationException(getClass().getName());
}
/**
* Added this method for middlegen's TypeConstraint
*
* @param className Describe what the parameter does
* @return Describe the return value
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
public boolean subclassOf(String className) {
boolean result = false;
XClass superclass = this;
while (superclass != null) {
if (superclass.qualifiedName().equals(className)) {
result = true;
break;
}
XClass superclass2 = superclass.superclass();
if (superclass2 != null) {
_log.debug(superclass.qualifiedName() + " SUPERCLASS
IS " + superclass2.qualifiedName());
}
superclass = superclass2;
}
return result;
}
/**
* Added this method for middlegen's TypeConstraint
*
* @param interfaceName Describe what the parameter does
* @return Describe the return value
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
public boolean implementsInterface(String interfaceName) {
boolean result = false;
XClass[] interfaces = interfaces();
for (int i = interfaces.length - 1; i >= 0; i--) {
_log.debug(qualifiedName() + " IMPLEMENTS " +
interfaces[i].qualifiedName());
if (interfaces[i].qualifiedName().equals(interfaceName)) {
result = true;
break;
}
}
return result;
}
/**
* Describe what the method does
*
* @param o Describe what the parameter does
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
public int compareTo(Object o) {
return name().compareTo(((XClass)o).name());
}
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public String toString() {
return qualifiedName();
}
}
1.1 xjavadoc/src/xjavadoc/XField.java
Index: XField.java
===================================================================
/*
* Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of BEKK Consulting nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Change log
*
*/
package xjavadoc;
/**
* Describe what this class does
*
* @author Ara Abrahamian
* @created February 16, 2002
* @todo-javadoc Write javadocs for interface
*/
public interface XField extends XProgramElement {
/**
* Gets the Transient attribute of the XField object
*
* @return The Transient value
*/
public boolean isTransient();
/**
* Gets the Volatile attribute of the XField object
*
* @return The Volatile value
*/
public boolean isVolatile();
}
1.1 xjavadoc/src/xjavadoc/XProgramElement.java
Index: XProgramElement.java
===================================================================
/*
* Copyright (c) 2001, Aslak Helles�y, BEKK Consulting
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of BEKK Consulting nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
/*
* Change log
*
*/
package xjavadoc;
/**
* Describe what this class does
*
* @author Ara Abrahamian
* @created February 16, 2002
* @todo-javadoc Write javadocs for interface
*/
public interface XProgramElement extends Documented {
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public XClass containingClass();
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public XPackage containingPackage();
/**
* Gets the Final attribute of the XProgramElement object
*
* @return The Final value
*/
public boolean isFinal();
/**
* Gets the PackagePrivate attribute of the XProgramElement object
*
* @return The PackagePrivate value
*/
public boolean isPackagePrivate();
/**
* Gets the Private attribute of the XProgramElement object
*
* @return The Private value
*/
public boolean isPrivate();
/**
* Gets the Protected attribute of the XProgramElement object
*
* @return The Protected value
*/
public boolean isProtected();
/**
* Gets the Public attribute of the XProgramElement object
*
* @return The Public value
*/
public boolean isPublic();
/**
* Gets the Static attribute of the XProgramElement object
*
* @return The Static value
*/
public boolean isStatic();
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public String modifiers();
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public int modifierSpecifier();
/**
* Describe what the method does
*
* @return Describe the return value
* @todo-javadoc Write javadocs for method
* @todo-javadoc Write javadocs for return value
*/
public String qualifiedName();
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel