User: rinkrank
Date: 02/03/01 04:07:36
Modified: core/src/xdoclet XDocletTagSupport.java
Log:
-Refactored common logic in Field/Constructor/MethodTagsHandler up in
AbstractProgramElementTagsHandler
(It was pretty bad inheritance-by-copy-paste, and I was guilty of parts of it)
Revision Changes Path
1.23 +148 -148 xdoclet/core/src/xdoclet/XDocletTagSupport.java
Index: XDocletTagSupport.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletTagSupport.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -r1.22 -r1.23
--- XDocletTagSupport.java 28 Feb 2002 20:22:48 -0000 1.22
+++ XDocletTagSupport.java 1 Mar 2002 12:07:36 -0000 1.23
@@ -27,7 +27,7 @@
*
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created October 12, 2001
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.23 $
*/
public abstract class XDocletTagSupport extends TemplateTagHandler
{
@@ -252,6 +252,153 @@
}
/**
+ * Provides the current method in the XDoclet build, or null if there is no
+ * current method.
+ *
+ * @return The CurrentMethod value
+ * @see #setCurrentMethod
+ */
+ public static MethodDoc getCurrentMethod()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentMethod();
+ }
+
+ /**
+ * Provides the current field in the XDoclet build, or null if there is no
+ * current field.
+ *
+ * @return The CurrentField value
+ * @see #setCurrentField
+ */
+ public static FieldDoc getCurrentField()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentField();
+ }
+
+ /**
+ * Provides the current constructor in the XDoclet build, or null if there is
+ * no current constructor.
+ *
+ * @return The CurrentConstructor value
+ * @see #setCurrentConstructor
+ */
+ public static ConstructorDoc getCurrentConstructor()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentConstructor();
+ }
+
+ /**
+ * Provides the current class in the XDoclet build, or null if there is no
+ * current class.
+ *
+ * @return The CurrentClass value
+ * @see #pushCurrentClass
+ * @see #popCurrentClass
+ */
+ public static ClassDoc getCurrentClass()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentClass();
+ }
+
+ /**
+ * Provides the current package in the XDoclet build, or null if there is no
+ * current package.
+ *
+ * @return The CurrentPackage value
+ */
+ public static PackageDoc getCurrentPackage()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentPackage();
+ }
+
+ /**
+ * Set the current method.
+ *
+ * @param method The method to make the current method
+ * @see #getCurrentMethod
+ */
+ public static void setCurrentMethod( MethodDoc method )
+ {
+ getDocletContext().getActiveSubTask().setCurrentMethod( method );
+ }
+
+ /**
+ * Set the current constructor.
+ *
+ * @param constructor The constructor to make the current constructor
+ * @see #getCurrentConstructor
+ */
+ public static void setCurrentConstructor( ConstructorDoc constructor )
+ {
+ getDocletContext().getActiveSubTask().setCurrentConstructor(
constructor );
+ }
+
+ /**
+ * Sets current class to clazz by clearing currentClassStack stack and pushing
+ * clazz into top of it.
+ *
+ * @param clazz The new CurrentClass value
+ * @see #getCurrentClass()
+ */
+ public static void setCurrentClass( ClassDoc clazz )
+ {
+ getDocletContext().getActiveSubTask().setCurrentClass( clazz );
+ }
+
+ /**
+ * Set the current package
+ *
+ * @param pakkage The new CurrentPackage value
+ * @see #getCurrentPackage
+ */
+ public static void setCurrentPackage( PackageDoc pakkage )
+ {
+ getDocletContext().getActiveSubTask().setCurrentPackage( pakkage );
+ }
+
+ public static void setCurrentTag( Tag currentTag )
+ {
+ getDocletContext().getActiveSubTask().setCurrentTag( currentTag );
+ }
+
+ /**
+ * Set the current field.
+ *
+ * @param field The field to make the current field
+ * @see #getCurrentMethod
+ */
+ public static void setCurrentField( FieldDoc field )
+ {
+ getDocletContext().getActiveSubTask().setCurrentField( field );
+ }
+
+ /**
+ * Push the specified class to the top of the current class stack making it
+ * effectively the current class.
+ *
+ * @param clazz The class to push onto the top of the class stack.
+ * @return The class on the top of the stack.
+ * @see #getCurrentClass
+ * @see #popCurrentClass
+ */
+ public static ClassDoc pushCurrentClass( ClassDoc clazz )
+ {
+ return getDocletContext().getActiveSubTask().pushCurrentClass( clazz );
+ }
+
+ /**
+ * Pop the current class off the top of the class stack.
+ *
+ * @return The class popped off the top of the stack.
+ * @see #getCurrentClass
+ * @see #pushCurrentClass
+ */
+ public static ClassDoc popCurrentClass()
+ {
+ return getDocletContext().getActiveSubTask().popCurrentClass();
+ }
+
+ /**
* @return the context object casted to DocletContext
*/
protected static DocletContext getDocletContext()
@@ -674,66 +821,6 @@
}
/**
- * Provides the current method in the XDoclet build, or null if there is no
- * current method.
- *
- * @return The CurrentMethod value
- * @see #setCurrentMethod
- */
- public MethodDoc getCurrentMethod()
- {
- return getDocletContext().getActiveSubTask().getCurrentMethod();
- }
-
- /**
- * Provides the current field in the XDoclet build, or null if there is no
- * current field.
- *
- * @return The CurrentField value
- * @see #setCurrentField
- */
- public FieldDoc getCurrentField()
- {
- return getDocletContext().getActiveSubTask().getCurrentField();
- }
-
- /**
- * Provides the current constructor in the XDoclet build, or null if there is
- * no current constructor.
- *
- * @return The CurrentConstructor value
- * @see #setCurrentConstructor
- */
- public ConstructorDoc getCurrentConstructor()
- {
- return getDocletContext().getActiveSubTask().getCurrentConstructor();
- }
-
- /**
- * Provides the current class in the XDoclet build, or null if there is no
- * current class.
- *
- * @return The CurrentClass value
- * @see #pushCurrentClass
- * @see #popCurrentClass
- */
- public ClassDoc getCurrentClass()
- {
- return getDocletContext().getActiveSubTask().getCurrentClass();
- }
-
- /**
- * Provides the current package in the XDoclet build, or null if there is no
- * current package.
- *
- * @return The CurrentPackage value
- */
- public PackageDoc getCurrentPackage()
- {
- return getDocletContext().getActiveSubTask().getCurrentPackage();
- }
-
- /**
* For classes.
*
* @param tag_name Description of Parameter
@@ -749,93 +836,6 @@
public String getClassTagValue( String tag_name, String param_name, int
param_num, String valid_values, String default_value, boolean superclasses, boolean
is_mandatory ) throws XDocletException
{
return getClassTagValue( getCurrentClass(), tag_name, param_name,
param_num, valid_values, default_value, superclasses, is_mandatory );
- }
-
- /**
- * Set the current method.
- *
- * @param method The method to make the current method
- * @see #getCurrentMethod
- */
- public void setCurrentMethod( MethodDoc method )
- {
- getDocletContext().getActiveSubTask().setCurrentMethod( method );
- }
-
- /**
- * Set the current constructor.
- *
- * @param constructor The constructor to make the current constructor
- * @see #getCurrentConstructor
- */
- public void setCurrentConstructor( ConstructorDoc constructor )
- {
- getDocletContext().getActiveSubTask().setCurrentConstructor(
constructor );
- }
-
- /**
- * Sets current class to clazz by clearing currentClassStack stack and pushing
- * clazz into top of it.
- *
- * @param clazz The new CurrentClass value
- * @see #getCurrentClass()
- */
- public void setCurrentClass( ClassDoc clazz )
- {
- getDocletContext().getActiveSubTask().setCurrentClass( clazz );
- }
-
- /**
- * Set the current package
- *
- * @param pakkage The new CurrentPackage value
- * @see #getCurrentPackage
- */
- public void setCurrentPackage( PackageDoc pakkage )
- {
- getDocletContext().getActiveSubTask().setCurrentPackage( pakkage );
- }
-
- public void setCurrentTag( Tag currentTag )
- {
- getDocletContext().getActiveSubTask().setCurrentTag( currentTag );
- }
-
- /**
- * Set the current field.
- *
- * @param field The field to make the current field
- * @see #getCurrentMethod
- */
- public void setCurrentField( FieldDoc field )
- {
- getDocletContext().getActiveSubTask().setCurrentField( field );
- }
-
- /**
- * Push the specified class to the top of the current class stack making it
- * effectively the current class.
- *
- * @param clazz The class to push onto the top of the class stack.
- * @return The class on the top of the stack.
- * @see #getCurrentClass
- * @see #popCurrentClass
- */
- public ClassDoc pushCurrentClass( ClassDoc clazz )
- {
- return getDocletContext().getActiveSubTask().pushCurrentClass( clazz );
- }
-
- /**
- * Pop the current class off the top of the class stack.
- *
- * @return The class popped off the top of the stack.
- * @see #getCurrentClass
- * @see #pushCurrentClass
- */
- public ClassDoc popCurrentClass()
- {
- return getDocletContext().getActiveSubTask().popCurrentClass();
}
/**
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel