User: dimc
Date: 02/04/04 05:48:14
Modified: core/src/xdoclet/tags ClassTagsHandler.java
Log:
Fix for bug 523372 - ant property variables were not being dereferenced.
Also changes that I believe are due to <pretty />
Revision Changes Path
1.31 +520 -452 xdoclet/core/src/xdoclet/tags/ClassTagsHandler.java
Index: ClassTagsHandler.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/tags/ClassTagsHandler.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -w -r1.30 -r1.31
--- ClassTagsHandler.java 4 Apr 2002 01:03:05 -0000 1.30
+++ ClassTagsHandler.java 4 Apr 2002 13:48:13 -0000 1.31
@@ -24,15 +24,47 @@
/**
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created Oct 14, 2001
- * @version $Revision: 1.30 $
+ * @version $Revision: 1.31 $
*/
-public class ClassTagsHandler extends AbstractProgramElementTagsHandler {
+public class ClassTagsHandler extends AbstractProgramElementTagsHandler
+{
/**
* Used for setting the timestamp for xdoclet-generated marker in generated
* files.
*/
protected final static DateFormat dateFormatter =
DateFormat.getDateTimeInstance();
+ /**
+ * Returns the not-full-qualified name of the current class without the package
+ * name.
+ *
+ * @param clazz Description of Parameter
+ * @return Description of the Returned Value
+ * @todo duplicate in AbstractProgramElementTagsHandler
+ * @doc:tag type="content"
+ * @deprecated use XClass.name()
+ */
+ public static String getClassNameFor( XClass clazz )
+ {
+ return clazz.name();
+ }
+
+ /**
+ * Returns the full-qualified name of the current class with the package name.
+ *
+ * @param clazz Description of Parameter
+ * @return Description of the Returned Value
+ * @doc:tag type="content"
+ * @deprecated use XClass.qualifiedName()
+ */
+ public static String getFullClassNameFor( XClass clazz )
+ {
+ if( clazz.containingClass() != null )
+ {
+ return clazz.containingClass().qualifiedName();
+ }
+ return clazz.qualifiedName();
+ }
/**
* Returns the not-full-qualified name of the current class without the package
@@ -42,11 +74,11 @@
* @exception XDocletException Description of Exception
* @doc:tag type="content"
*/
- public String className() throws XDocletException {
+ public String className() throws XDocletException
+ {
return getCurrentClass().name();
}
-
/**
* Returns the full-qualified name of the superclass of the current class.
*
@@ -54,11 +86,11 @@
* @exception XDocletException Description of Exception
* @doc:tag type="content"
*/
- public String fullClassName() throws XDocletException {
+ public String fullClassName() throws XDocletException
+ {
return getFullClassNameFor(getCurrentClass());
}
-
/**
* Returns the full-qualified name of the superclass of the current class.
*
@@ -66,11 +98,11 @@
* @exception XDocletException Description of Exception
* @doc:tag type="content"
*/
- public String fullSuperclassName() throws XDocletException {
+ public String fullSuperclassName() throws XDocletException
+ {
return getFullSuperclassNameFor(getCurrentClass());
}
-
/**
* Returns the not-full-qualified name of the full-qualified class name
* specified in the body of this tag.
@@ -79,20 +111,23 @@
* @exception XDocletException Description of Exception
* @doc:tag type="block"
*/
- public void classOf(String template) throws XDocletException {
- try {
+ public void classOf( String template ) throws XDocletException
+ {
+ try
+ {
String fullClassName = getEngine().outputOf(template);
String result =
fullClassName.substring(fullClassName.lastIndexOf(".") + 1);
getEngine().print(result);
//use out.print because it's a block tag and can't return a
String
- } catch (TemplateException ex) {
+ }
+ catch( TemplateException ex )
+ {
throw new XDocletException(ex,
Translator.getString("method_failed",
new String[]{"ClassTagsHandler.classOf"}));
}
}
-
/**
* Evaluate the body block if current class is abstract.
*
@@ -101,13 +136,14 @@
* @see #ifIsClassNotAbstract(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsClassAbstract(String template) throws XDocletException {
- if (getCurrentClass().isAbstract()) {
+ public void ifIsClassAbstract( String template ) throws XDocletException
+ {
+ if( getCurrentClass().isAbstract() )
+ {
generate(template);
}
}
-
/**
* Evaluate the body block if current class is not abstract.
*
@@ -116,13 +152,14 @@
* @see #ifIsClassAbstract(java.lang.String)
* @doc:tag type="block"
*/
- public void ifIsClassNotAbstract(String template) throws XDocletException {
- if (!getCurrentClass().isAbstract()) {
+ public void ifIsClassNotAbstract( String template ) throws XDocletException
+ {
+ if( !getCurrentClass().isAbstract() )
+ {
generate(template);
}
}
-
/**
* Pushes the class specified by value parameter to top of stack making it the
* current class.
@@ -131,18 +168,24 @@
* @param template The body of the block tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="value" optional="false" values="return-type,whatever class
- * name" description="If return-type specified then push current method
- * return type, else find the XClass for the class name and push it."
+ * @doc:param name="value" optional="false"
+ * values="return-type,whatever class name" description="If return-type
+ * specified then push current method return type, else find the XClass
+ * for the class name and push it."
*/
- public void pushClass(String template, Properties attributes) throws
XDocletException {
+ public void pushClass( String template, Properties attributes ) throws
XDocletException
+ {
String value = attributes.getProperty("value", null);
XClass cur_class = null;
- if (value == null) {
- try {
+ if( value == null )
+ {
+ try
+ {
value = getEngine().outputOf(template);
- } catch (TemplateException ex) {
+ }
+ catch( TemplateException ex )
+ {
throw new XDocletException(ex,
Translator.getString("method_failed",
new String[]{"pushClass"}));
}
@@ -150,7 +193,8 @@
cur_class = XJavaDoc.getInstance().getXClass(value);
- if (cur_class == null) {
+ if( cur_class == null )
+ {
throw new
XDocletException(Translator.getString("javadoc_couldnt_load_class",
new String[]{value}));
}
@@ -164,7 +208,6 @@
setCurrentMethod(old_method);
}
-
/**
* Iterates over all classes loaded by javadoc and evaluates the body of the
* tag for each class. It descards classes that have a xdoclet-generated class
@@ -174,11 +217,11 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="abstract" optional="true" values="true,false"
- * description="If true then accept abstract classes also; otherwise
- * don't."
- * @doc:param name="type" optional="true" description="For all classes by the
- * type."
+ * @doc:param name="abstract" optional="true"
+ * values="true,false" description="If true then accept abstract classes
+ * also; otherwise don't."
+ * @doc:param name="type" optional="true" description="For
+ * all classes by the type."
* @doc:param name="extent" optional="true"
* values="concrete-type,superclass,hierarchy" description="Specifies the
* extent of the type search. If concrete-type then only check the
@@ -186,7 +229,8 @@
* then search the whole hierarchy and find if the class is of the
* specified type. Default is hierarchy."
*/
- public void forAllClasses(String template, Properties attributes) throws
XDocletException {
+ public void forAllClasses( String template, Properties attributes ) throws
XDocletException
+ {
Category cat = Log.getCategory(ClassTagsHandler.class,
"forAllClasses");
String abstract_str = attributes.getProperty("abstract");
@@ -195,7 +239,8 @@
String extent_str = attributes.getProperty("extent");
int extent = TypeTagsHandler.extractExtentType(extent_str);
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("accept_abstract_classes=" +
accept_abstract_classes);
cat.debug("type_name=" + type_name);
cat.debug("extent_str=" + extent_str);
@@ -205,32 +250,40 @@
XClass[] classes = getAllClasses();
XClass cur_class = null;
- for (int i = 0; i < classes.length; i++) {
+ for( int i = 0; i < classes.length; i++ )
+ {
cur_class = classes[i];
setCurrentClass(cur_class);
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("cur_class=" + cur_class);
}
- if (DocletSupport.isDocletGenerated(getCurrentClass()) ||
(getCurrentClass().isAbstract() == true && accept_abstract_classes == false)) {
- if (cat.isDebugEnabled()) {
+ if( DocletSupport.isDocletGenerated( getCurrentClass() ) || (
getCurrentClass().isAbstract() == true && accept_abstract_classes == false ) )
+ {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("isDocletGenerated or isAbstract");
}
continue;
}
- if (type_name != null) {
- if (TypeTagsHandler.isOfType(cur_class, type_name,
extent)) {
+ if( type_name != null )
+ {
+ if( TypeTagsHandler.isOfType( cur_class, type_name,
extent ) )
+ {
cat.debug("isOfType true, generate().");
generate(template);
}
- else {
+ else
+ {
cat.debug("isOfType false, generate().");
}
}
- else {
+ else
+ {
cat.debug("type_name=null, generate().");
generate(template);
@@ -238,7 +291,6 @@
}
}
-
/**
* Describe what the method does
*
@@ -248,11 +300,11 @@
* @todo-javadoc Write javadocs for return value
* @todo-javadoc Write javadocs for exception
*/
- public String modifiers() throws XDocletException {
+ public String modifiers() throws XDocletException
+ {
return modifiers(FOR_CLASS);
}
-
/**
* Returns the symbolic name of the current class. For a java bean it's the
* same as the class name.
@@ -261,12 +313,12 @@
* @exception XDocletException Description of Exception
* @doc:tag type="content"
*/
- public String symbolicClassName() throws XDocletException {
+ public String symbolicClassName() throws XDocletException
+ {
// (Aslak) not sure if this is correct
return getCurrentClass().name();
}
-
/**
* Evaluates the body if current class doesn't have at least one tag with the
* specified name.
@@ -275,32 +327,36 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
- * @doc:param name="error" description="Show this error message if no tag
- * found."
- */
- public void ifDoesntHaveClassTag(String template, Properties attributes)
throws XDocletException {
- if (!hasTag(attributes, FOR_CLASS)) {
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
+ * @doc:param name="error" description="Show this error
+ * message if no tag found."
+ */
+ public void ifDoesntHaveClassTag( String template, Properties attributes )
throws XDocletException
+ {
+ if( !hasTag( attributes, FOR_CLASS ) )
+ {
generate(template);
}
- else {
+ else
+ {
String error = attributes.getProperty("error");
- if (error != null) {
+ if( error != null )
+ {
getEngine().print(error);
}
}
}
-
/**
* Evaluates the body if current class has at least one tag with the specified
* name.
@@ -309,61 +365,66 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
- * @doc:param name="error" description="Show this error message if no tag
- * found."
- */
- public void ifHasClassTag(String template, Properties attributes) throws
XDocletException {
- if (hasTag(attributes, FOR_CLASS)) {
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
+ * @doc:param name="error" description="Show this error
+ * message if no tag found."
+ */
+ public void ifHasClassTag( String template, Properties attributes ) throws
XDocletException
+ {
+ if( hasTag( attributes, FOR_CLASS ) )
+ {
generate(template);
}
- else {
+ else
+ {
String error = attributes.getProperty("error");
- if (error != null) {
+ if( error != null )
+ {
getEngine().print(error);
}
}
}
-
/**
* Evaluate the body if the match variable equals with the value of the
* specified tag/parameter.
*
- * @todo (Aslak) It appears that this method does the same job as
- * ifClassTagValueEquals. It also appears that no templates are using it.
- * Candidate for removal?
* @param template The body of the block tag
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
- * @doc:tag type="block"
- * @doc:param name="values" description="The valid values for the parameter,
- * comma separated. An error message is printed if the parameter value is
- * not one of the values."
- * @doc:param name="default" description="The default value is returned if
- * parameter not specified by user for the tag."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
+ * @todo (Aslak) It appears that this method does the
+ * same job as ifClassTagValueEquals. It also appears that no templates
+ * are using it. Candidate for removal?
+ * @doc:tag type="block"
+ * @doc:param name="values" description="The valid values for
+ * the parameter, comma separated. An error message is printed if the
+ * parameter value is not one of the values."
+ * @doc:param name="default" description="The default value
+ * is returned if parameter not specified by user for the tag."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
*/
- public void ifClassTagValueMatches(String template, Properties attributes)
throws XDocletException {
+ public void ifClassTagValueMatches( String template, Properties attributes )
throws XDocletException
+ {
String wanted_tag_value = getTagValue(attributes, FOR_CLASS);
- if (wanted_tag_value.equals(matchPattern)) {
+ if( wanted_tag_value.equals( matchPattern ) )
+ {
generate(template);
}
}
-
/**
* Evaluates the body if value for the class tag equals the specified value.
*
@@ -371,21 +432,24 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
- * @doc:param name="value" optional="false" description="The desired value."
- */
- public void ifClassTagValueEquals(String template, Properties attributes)
throws XDocletException {
- if (isTagValueEqual(attributes, FOR_CLASS)) {
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
+ * @doc:param name="value" optional="false" description="The
+ * desired value."
+ */
+ public void ifClassTagValueEquals( String template, Properties attributes )
throws XDocletException
+ {
+ if( isTagValueEqual( attributes, FOR_CLASS ) )
+ {
generate(template);
}
}
-
/**
* Evaluates the body if value for the class tag not equals the specified
* value.
@@ -394,21 +458,24 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
- * @doc:param name="value" optional="false" description="The desired value."
- */
- public void ifClassTagValueNotEquals(String template, Properties attributes)
throws XDocletException {
- if (!isTagValueEqual(attributes, FOR_CLASS)) {
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
+ * @doc:param name="value" optional="false" description="The
+ * desired value."
+ */
+ public void ifClassTagValueNotEquals( String template, Properties attributes )
throws XDocletException
+ {
+ if( !isTagValueEqual( attributes, FOR_CLASS ) )
+ {
generate(template);
}
}
-
/**
* Iterates over all class tags with the specified tagName and evaluates the
* body of the tag for each class tag.
@@ -417,26 +484,27 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
* @doc:tag type="content"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
- * @doc:param name="values" description="The valid values for the parameter,
- * comma separated. An error message is printed if the parameter value is
- * not one of the values."
- * @doc:param name="default" description="The default value is returned if
- * parameter not specified by user for the tag."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
- */
- public String classTagValue(Properties attributes) throws XDocletException {
- return getTagValue(attributes, FOR_CLASS);
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
+ * @doc:param name="values" description="The valid values for
+ * the parameter, comma separated. An error message is printed if the
+ * parameter value is not one of the values."
+ * @doc:param name="default" description="The default value
+ * is returned if parameter not specified by user for the tag."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
+ */
+ public String classTagValue( Properties attributes ) throws XDocletException
+ {
+ return dereferenceProperties( getTagValue( attributes, FOR_CLASS ) );
}
-
/**
* Sets the value of match variable. Match variable serves as a variable for
* templates, you set it somewhere in template and look it up somewhere else in
@@ -447,19 +515,20 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
* @doc:tag type="content"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="paramName" description="The parameter name. If not
- * specified, then the raw content of the tag is returned."
- * @doc:param name="paramNum" description="The zero-based parameter number.
- * It's used if the user used the space-separated format for specifying
- * parameters."
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="paramName" description="The parameter
+ * name. If not specified, then the raw content of the tag is returned."
+ * @doc:param name="paramNum" description="The zero-based
+ * parameter number. It's used if the user used the space-separated format
+ * for specifying parameters."
*/
- public String classTagValueMatch(Properties attributes) throws
XDocletException {
+ public String classTagValueMatch( Properties attributes ) throws
XDocletException
+ {
matchPattern = getTagValue(attributes, FOR_CLASS);
return "";
}
-
/**
* Iterates over all tags of current class with the name tagName and evaluates
* the body of the tag for each method.
@@ -468,15 +537,17 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The tag name."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
- * @doc:param name="tagKey" description="A tag property that will be used as a
- * unique key. This is used to avoid duplicate code due to similar tags in
- * superclasses."
+ * @doc:param name="tagName" optional="false"
+ * description="The tag name."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
+ * @doc:param name="tagKey" description="A tag property that
+ * will be used as a unique key. This is used to avoid duplicate code due
+ * to similar tags in superclasses."
*/
- public void forAllClassTags(String template, Properties attributes) throws
XDocletException {
+ public void forAllClassTags( String template, Properties attributes ) throws
XDocletException
+ {
boolean superclasses =
TypeConversionUtil.stringToBoolean(attributes.getProperty("superclasses"), true);
XTag[] tags =
getCurrentClass().doc().tags(attributes.getProperty("tagName"), superclasses);
Set done = new HashSet();
@@ -485,11 +556,14 @@
String tagKey = attributes.getProperty("tagKey");
- for (int i = 0; i < tags.length; i++) {
- if (tagKey != null) {
+ for( int i = 0; i < tags.length; i++ )
+ {
+ if( tagKey != null )
+ {
String key = tags[i].attributeValue(tagKey);
- if (!done.add(key)) {
+ if( !done.add( key ) )
+ {
// no change to set, therefore we must have
already done this tag
continue;
}
@@ -504,7 +578,6 @@
matchPattern = null;
}
-
/**
* Iterates over all tokens in specified class tag with the name tagName and
* evaluates the body for every token.
@@ -513,18 +586,21 @@
* @param attributes The attributes of the template tag
* @exception XDocletException Description of Exception
* @doc:tag type="block"
- * @doc:param name="tagName" optional="false" description="The name of the tag
- * to look in."
- * @doc:param name="paramName" optional="false" description="The parameter of
- * the tag whose value is to be tokenized."
- * @doc:param name="superclasses" values="true,false" description="If true then
- * traverse superclasses also, otherwise look up the tag in current
- * concrete class only."
- * @doc:param name="delimiter" description="delimiter for the StringTokenizer.
- * consult javadoc for java.util.StringTokenizer default is ','"
- * @doc:param name="skip" description="how many tokens to skip on start"
+ * @doc:param name="tagName" optional="false"
+ * description="The name of the tag to look in."
+ * @doc:param name="paramName" optional="false"
+ * description="The parameter of the tag whose value is to be tokenized."
+ * @doc:param name="superclasses" values="true,false"
+ * description="If true then traverse superclasses also, otherwise look up
+ * the tag in current concrete class only."
+ * @doc:param name="delimiter" description="delimiter for the
+ * StringTokenizer. consult javadoc for java.util.StringTokenizer default
+ * is ','"
+ * @doc:param name="skip" description="how many tokens to
+ * skip on start"
*/
- public void forAllClassTagTokens(String template, Properties attributes)
throws XDocletException {
+ public void forAllClassTagTokens( String template, Properties attributes )
throws XDocletException
+ {
Category cat = Log.getCategory(ClassTagsHandler.class,
"forAllClassTagTokens");
// get class tag value to iterate over
String tagValue = getTagValue(attributes, FOR_CLASS);
@@ -532,14 +608,19 @@
String skip_str = attributes.getProperty("skip");
int skip;
- try {
+ try
+ {
skip = Integer.valueOf(skip_str).intValue();
- } catch (Throwable t) {
+ }
+ catch( Throwable t )
+ {
skip = 0;
}
- if (delimiter == null) {
- if (cat.isDebugEnabled()) {
+ if( delimiter == null )
+ {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("got null delimiter - forAllClassTagTokens");
}
@@ -550,14 +631,17 @@
currentToken = "";
matchPattern = null;
- for (int i = 0; tagTokenizer.hasMoreTokens() && i < skip; i++) {
+ for( int i = 0; tagTokenizer.hasMoreTokens() && i < skip; i++ )
+ {
tagTokenizer.nextToken();
}
- while (tagTokenizer.hasMoreTokens()) {
+ while( tagTokenizer.hasMoreTokens() )
+ {
currentToken = tagTokenizer.nextToken();
- if (cat.isDebugEnabled()) {
+ if( cat.isDebugEnabled() )
+ {
cat.debug("generate current token: " + currentToken);
}
@@ -569,7 +653,6 @@
matchPattern = null;
}
-
/**
* The comment for the current class.
*
@@ -580,16 +663,18 @@
* @see #classCommentText(java.util.Properties)
* @see #classCommentTags(java.util.Properties)
* @doc:tag type="content"
- * @doc:param name="no-comment-signs" optional="true" values="true,false"
- * description="If true then don't decorate the comment with comment
- * signs. Default is false."
+ * @doc:param name="no-comment-signs" optional="true"
+ * values="true,false" description="If true then don't decorate the
+ * comment with comment signs. Default is false."
*/
- public String classComment(Properties attributes) throws XDocletException {
+ public String classComment( Properties attributes ) throws XDocletException
+ {
// Leave out the tags if no comment delimiters; I can't think of a
reason you'd
// still want them, since they won't do anything outside of javadoc
comments
boolean no_comment_signs =
TypeConversionUtil.stringToBoolean(attributes.getProperty("no-comment-signs"), false);
- if (no_comment_signs) {
+ if( no_comment_signs )
+ {
return getCurrentClass().doc().commentText();
}
@@ -604,7 +689,6 @@
return result.toString();
}
-
/**
* The text of the javadoc comment for the current class.
*
@@ -614,14 +698,16 @@
* @see MethodTagsHandler#methodComment(java.util.Properties)
* @see #classComment(java.util.Properties)
* @doc:tag type="content"
- * @doc:param name="no-comment-signs" optional="true" values="true,false"
- * description="If true then don't decorate the comment with comment
- * signs. Default is false."
+ * @doc:param name="no-comment-signs" optional="true"
+ * values="true,false" description="If true then don't decorate the
+ * comment with comment signs. Default is false."
*/
- public String classCommentText(Properties attributes) throws XDocletException {
+ public String classCommentText( Properties attributes ) throws XDocletException
+ {
boolean no_comment_signs =
TypeConversionUtil.stringToBoolean(attributes.getProperty("no-comment-signs"), false);
- if (no_comment_signs) {
+ if( no_comment_signs )
+ {
return getCurrentClass().doc().commentText();
}
@@ -633,7 +719,6 @@
return result.toString();
}
-
/**
* The javadoc comment tags for the current class (plus xdoclet-generated).
*
@@ -643,26 +728,31 @@
* @see MethodTagsHandler#methodComment(java.util.Properties)
* @see #classComment(java.util.Properties)
* @doc:tag type="content"
- * @doc:param name="include-xdoclet-generated" optional="true"
- * values="true,false" description="If false then don't add an
- * xdoclet-generated tag. Default is true."
+ * @doc:param name="include-xdoclet-generated"
+ * optional="true" values="true,false" description="If false then don't
+ * add an xdoclet-generated tag. Default is true."
*/
- public String classCommentTags(Properties attributes) throws XDocletException {
+ public String classCommentTags( Properties attributes ) throws XDocletException
+ {
char[] spaces = getIndentChars(attributes);
XTag[] class_tags = getCurrentClass().doc().tags();
StringBuffer result = new StringBuffer();
- for (int i = 0; i < class_tags.length; i++) {
+ for( int i = 0; i < class_tags.length; i++ )
+ {
//omit ejbdoclet-specific tags, which all have a ":" or "."
String class_tag = class_tags[i].name();
- if (class_tag.lastIndexOf(':') == -1 &&
class_tag.lastIndexOf('.') == -1) {
+ if( class_tag.lastIndexOf( ':' ) == -1 &&
class_tag.lastIndexOf( '.' ) == -1 )
+ {
result.append(spaces).append(" *
@").append(class_tags[i].name()).append(' ');
- if
(getDocletContext().getExcludedTags().indexOf(class_tags[i].name()) == -1) {
+ if( getDocletContext().getExcludedTags().indexOf(
class_tags[i].name() ) == -1 )
+ {
result.append(class_tags[i].value()).append(PrettyPrintWriter.LINE_SEPARATOR);
}
- else {
+ else
+ {
result.append("XDOCLET
").append(DocletTask.XDOCLET_VERSION).append(PrettyPrintWriter.LINE_SEPARATOR);
}
@@ -674,7 +764,8 @@
// add an @xdoclet-generated, unless we were told not to
boolean include_xdoclet_generated =
TypeConversionUtil.stringToBoolean(attributes.getProperty("include-xdoclet-generated"),
true);
- if (include_xdoclet_generated) {
+ if( include_xdoclet_generated )
+ {
Calendar now = Calendar.getInstance();
result.append(spaces).append(" * @xdoclet-generated at
").append(dateFormatter.format(now.getTime())).append(PrettyPrintWriter.LINE_SEPARATOR);
@@ -683,7 +774,6 @@
return result.toString();
}
-
/**
* Return standard javadoc of current class.
*
@@ -691,17 +781,21 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
* @doc:tag type="content"
- * @doc:param name="no-description-if-lacking" optional="true"
- * description="Returns 'No Description' if comment is lacking."
+ * @doc:param name="no-description-if-lacking"
+ * optional="true" description="Returns 'No Description' if comment is
+ * lacking."
*/
- public String firstSentenceDescription(Properties attributes) throws
XDocletException {
+ public String firstSentenceDescription( Properties attributes ) throws
XDocletException
+ {
String desc = getCurrentClass().doc().firstSentence();
- if (desc == null) {
+ if( desc == null )
+ {
String no_description_if_lacking_str =
attributes.getProperty("no-description-if-lacking");
boolean no_description_if_lacking =
TypeConversionUtil.stringToBoolean(no_description_if_lacking_str, true);
- if (no_description_if_lacking == true) {
+ if( no_description_if_lacking == true )
+ {
desc = Translator.getString("no_description");
}
}
@@ -710,7 +804,6 @@
return checkForWrap(desc.trim());
}
-
/**
* Iterates over all imported classes and packages imported in the current
* class and returns the list. The composed string has 'import ' in front of
@@ -721,10 +814,12 @@
* @exception XDocletException Description of Exception
* @doc:tag type="block"
*/
- public String importedList(Properties attributes) throws XDocletException {
+ public String importedList( Properties attributes ) throws XDocletException
+ {
String currentClass = attributes.getProperty("currentClass");
- if (currentClass == null) {
+ if( currentClass == null )
+ {
throw new
XDocletException(Translator.getString("tag_must_include_a_property",
new String[]{"importList", "currentClass"}));
}
@@ -735,48 +830,21 @@
XPackage[] packages = getCurrentClass().importedPackages();
XClass[] classes = getCurrentClass().importedClasses();
- for (int i = 0; i < packages.length; i++) {
- if (!packages[i].name().equals(currentPackage)) {
+ for( int i = 0; i < packages.length; i++ )
+ {
+ if( !packages[i].name().equals( currentPackage ) )
+ {
st.append("import
").append(packages[i].name()).append(".*;").append(PrettyPrintWriter.LINE_SEPARATOR);
}
}
- for (int i = 0; i < classes.length; i++) {
- if
(!PackageTagsHandler.getPackageNameFor(classes[i].toString()).equals(currentPackage)) {
+ for( int i = 0; i < classes.length; i++ )
+ {
+ if( !PackageTagsHandler.getPackageNameFor(
classes[i].toString() ).equals( currentPackage ) )
+ {
st.append("import
").append(classes[i].toString()).append(";").append(PrettyPrintWriter.LINE_SEPARATOR);
}
}
return st.toString();
- }
-
-
- /**
- * Returns the not-full-qualified name of the current class without the package
- * name.
- *
- * @todo duplicate in AbstractProgramElementTagsHandler
- * @param clazz Description of Parameter
- * @return Description of the Returned Value
- * @doc:tag type="content"
- * @deprecated use XClass.name()
- */
- public static String getClassNameFor(XClass clazz) {
- return clazz.name();
- }
-
-
- /**
- * Returns the full-qualified name of the current class with the package name.
- *
- * @param clazz Description of Parameter
- * @return Description of the Returned Value
- * @doc:tag type="content"
- * @deprecated use XClass.qualifiedName()
- */
- public static String getFullClassNameFor(XClass clazz) {
- if (clazz.containingClass() != null) {
- return clazz.containingClass().qualifiedName();
- }
- return clazz.qualifiedName();
}
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel