User: rinkrank
Date: 02/03/24 09:44:19
Modified: core/src/xdoclet/jmx/tags JMXTagsHandler.java
Log:
Merging changes from XJAVADOC_REFACTORING branch back to main branch
Revision Changes Path
1.6 +46 -25 xdoclet/core/src/xdoclet/jmx/tags/JMXTagsHandler.java
Index: JMXTagsHandler.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/jmx/tags/JMXTagsHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- JMXTagsHandler.java 28 Feb 2002 20:22:48 -0000 1.5
+++ JMXTagsHandler.java 24 Mar 2002 17:44:19 -0000 1.6
@@ -1,11 +1,11 @@
package xdoclet.jmx.tags;
-import com.sun.javadoc.*;
+import xjavadoc.*;
import xdoclet.XDocletException;
import xdoclet.tags.AbstractProgramElementTagsHandler;
import xdoclet.tags.MethodTagsHandler;
-import xdoclet.util.DocletUtil;
+
import xdoclet.util.Translator;
import java.util.Collections;
@@ -19,7 +19,7 @@
* @author Jerome Bernard ([EMAIL PROTECTED])
* @author Ara Abrahamian ([EMAIL PROTECTED])
* @created 31 January 2002
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @todo attributes - XXX: Does this need to be synchronized?
* @todo ifIsGetterMethod, ifIsSetterMethod - TODO: There is a big overlap
* here with stuff in ejb - have a look.
@@ -97,9 +97,17 @@
{
boolean hasGetterMethod = false;
String name = handler.methodNameWithoutPrefix();
- String description = getMethodTagValue( "jmx:managed-attribute",
"description", -1, null, null, true );
+ String description = getTagValue(
+ FOR_METHOD,
+ "jmx:managed-attribute",
+ "description",
+ null,
+ null,
+ true,
+ false
+ );
- MethodDoc[] methods = getCurrentClass().methods();
+ XMethod[] methods = getCurrentClass().methods();
for( int i = 0; i < methods.length; i++ )
{
@@ -116,9 +124,10 @@
public void forAllIndexedMethodParams( String template, Properties attributes
) throws XDocletException
{
- Tag[] tags = DocletUtil.getTagsByName( getCurrentMethod(),
"jmx:managed-operation-parameter" );
+ XTag[] tags = getCurrentMethod().doc().tags(
"jmx:managed-operation-parameter" );
index = 0;
+ // Aslak: should i really start with 1 and not 0? This deserves a
comment.
for( int i = 1; i < tags.length; i++ )
{
generate( template );
@@ -128,9 +137,10 @@
public void forAllIndexedConstructorParams( String template, Properties
attributes ) throws XDocletException
{
- Tag[] tags = DocletUtil.getTagsByName( getCurrentConstructor(),
"jmx:managed-constructor-parameter" );
+ XTag[] tags = getCurrentConstructor().doc().tags(
"jmx:managed-constructor-parameter" );
index = 0;
+ // Aslak: should i really start with 1 and not 0? This deserves a
comment.
for( int i = 1; i < tags.length; i++ )
{
generate( template );
@@ -138,6 +148,9 @@
}
}
+ /**
+ * @todo refactor common code with indexedConstructorParamValue into a private
method
+ */
public String indexedMethodParamValue( Properties attributes ) throws
XDocletException
{
String tagName = attributes.getProperty( "tagName" );
@@ -145,8 +158,8 @@
if( tagName == null || paramName == null )
throw new XDocletException( Translator.getString(
"xdoclet.jmx.Messages", "missing_attribute" ) );
- Tag[] tags = DocletUtil.getTagsByName( getCurrentMethod(), tagName );
- String tagContent = tags[index].text();
+ XTag[] tags = getCurrentMethod().doc().tags(tagName );
+ String tagContent = tags[index].value();
int begin = tagContent.indexOf( paramName + "=\"" ) +
paramName.length() + 2;
int end = tagContent.indexOf( "\"", begin );
@@ -160,8 +173,8 @@
if( tagName == null || paramName == null )
throw new XDocletException( Translator.getString(
"xdoclet.jmx.Messages", "missing_attribute" ) );
- Tag[] tags = DocletUtil.getTagsByName( getCurrentConstructor(),
tagName );
- String tagContent = tags[index].text();
+ XTag[] tags = getCurrentMethod().doc().tags(tagName );
+ String tagContent = tags[index].value();
int begin = tagContent.indexOf( paramName + "=\"" ) +
paramName.length() + 2;
int end = tagContent.indexOf( "\"", begin );
@@ -170,7 +183,7 @@
public String constructorSignature() throws XDocletException
{
- ConstructorDoc currentConstructor = getCurrentConstructor();
+ XConstructor currentConstructor = getCurrentConstructor();
String signature = currentConstructor.signature();
// Remove spaces from the signature
@@ -193,17 +206,17 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
*/
- protected String getMBeanName( ClassDoc clazz ) throws XDocletException
+ protected String getMBeanName( XClass clazz ) throws XDocletException
{
- String bean_val = DocletUtil.getText( clazz, "jmx:mbean" );
+ XTag bean_tag = clazz.doc().tag( "jmx:mbean" );
- if( bean_val == null )
+ if( bean_tag == null )
{
throw new XDocletException( Translator.getString(
"class_tag_expected",
new String[]{"@jmx:mbean", clazz.qualifiedName()} ) );
}
- String param_val =
AbstractProgramElementTagsHandler.getParameterValue( getCurrentClass(), bean_val,
"name", -1 );
+ String param_val = bean_tag.attributeValue( "name" );
if( param_val == null )
{
@@ -214,25 +227,33 @@
return param_val;
}
+ /**
+ * @todo (Aslak) this is very general stuff. It should be implemented higher
up in the hierarchy
+ * if it isn't already done somewhere
+ */
protected boolean isGetterMethod()
{
- String name = getCurrentMethod().name();
- Type retType = getCurrentMethod().returnType();
- Parameter[] params = getCurrentMethod().parameters();
+ String methodName = getCurrentMethod().name();
+ XClass retType = getCurrentMethod().returnType();
+ XParameter[] params = getCurrentMethod().parameters();
- if( !retType.toString().equals( "void" ) && params.length == 0 )
- if( name.startsWith( "get" ) || ( name.startsWith( "is" ) &&
retType.toString().equals( "boolean" ) ) )
+ if( !retType.qualifiedName().equals( "void" ) && params.length == 0 )
+ if( methodName.startsWith( "get" ) || ( methodName.startsWith(
"is" ) && retType.qualifiedName().equals( "boolean" ) ) )
return true;
return false;
}
+ /**
+ * @todo (Aslak) this is very general stuff. It should be implemented higher
up in the hierarchy
+ * if it isn't already done somewhere
+ */
protected boolean isSetterMethod()
{
- String name = getCurrentMethod().name();
- Type retType = getCurrentMethod().returnType();
- Parameter[] params = getCurrentMethod().parameters();
+ String methodName = getCurrentMethod().name();
+ XClass retType = getCurrentMethod().returnType();
+ XParameter[] params = getCurrentMethod().parameters();
- return ( retType.toString().equals( "void" ) && params.length == 1 &&
name.startsWith( "set" ) );
+ return ( retType.qualifiedName().equals( "void" ) && params.length ==
1 && methodName.startsWith( "set" ) );
}
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel