User: rinkrank
Date: 02/03/16 10:22:14
Modified: core/src/xdoclet/ejb/tags/vendor Tag: XJAVADOC_REFACTORING
JBossRelationTagsHandler.java JBossTagsHandler.java
MVCSoftTagsHandler.java StrutsFormTagsHandler.java
WeblogicRelationTagsHandler.java
Log:
xjavadoc refactoring. doesn't work yet, but it compiles
Revision Changes Path
No revision
No revision
1.3.2.1 +67 -19
xdoclet/core/src/xdoclet/ejb/tags/vendor/JBossRelationTagsHandler.java
Index: JBossRelationTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/vendor/JBossRelationTagsHandler.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -w -r1.3 -r1.3.2.1
--- JBossRelationTagsHandler.java 9 Feb 2002 22:39:36 -0000 1.3
+++ JBossRelationTagsHandler.java 16 Mar 2002 18:22:14 -0000 1.3.2.1
@@ -2,14 +2,14 @@
import xdoclet.ejb.tags.RelationTagsHandler;
import xdoclet.XDocletException;
-import xdoclet.util.DocletUtil;
-import com.sun.javadoc.Tag;
-import com.sun.javadoc.MethodDoc;
+
+import xjavadoc.XTag;
+import xjavadoc.XMethod;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">David Budworth</a>
* @created Feb 4, 2002
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.2.1 $
*/
public class JBossRelationTagsHandler extends RelationTagsHandler
{
@@ -73,61 +73,109 @@
public String leftFKConstraint() throws XDocletException
{
- return getMethodTagValue( currentRelation.getLeftMethod(),
"jboss:relation", "fk-constraint", 0, null, "false", false );
+ return getTagValue(
+ currentRelation.getLeftMethod().doc(),
+ "jboss:relation",
+ "fk-constraint",
+ null,
+ "false",
+ false,
+ false
+ );
}
public String rightFKConstraint() throws XDocletException
{
if( isBidirectional() )
- return getMethodTagValue( currentRelation.getRightMethod(),
"jboss:relation", "fk-constraint", 0, null, "false", false );
+ return getTagValue(
+ currentRelation.getRightMethod().doc(),
+ "jboss:relation",
+ "fk-constraint",
+ null,
+ "false",
+ false,
+ false
+ );
else
- return getMethodTagValue( currentRelation.getLeftMethod(),
"jboss:target-relation", "fk-constraint", 0, null, "false", false );
+ return getTagValue(
+ currentRelation.getLeftMethod().doc(),
+ "jboss:target-relation",
+ "fk-constraint",
+ null,
+ "false",
+ false,
+ false
+ );
}
private boolean leftHasFKConstraint() throws XDocletException
{
- return getMethodTagValue( currentRelation.getLeftMethod(),
"jboss:relation", "fk-constraint", 0, null, null, false ) != null;
+ return getTagValue(
+ currentRelation.getLeftMethod().doc(),
+ "jboss:relation",
+ "fk-constraint",
+ null,
+ null,
+ false,
+ false
+ ) != null;
}
private boolean rightHasFKConstraint() throws XDocletException
{
if( isBidirectional() )
- return getMethodTagValue( currentRelation.getRightMethod(),
"jboss:relation", "fk-constraint", 0, null, null, false ) != null;
+ return getTagValue(
+ currentRelation.getRightMethod().doc(),
+ "jboss:relation",
+ "fk-constraint",
+ null,
+ null,
+ false,
+ false
+ ) != null;
else
- return getMethodTagValue( currentRelation.getLeftMethod(),
"jboss:target-relation", "fk-constraint", 0, null, null, false ) != null;
+ return getTagValue(
+ currentRelation.getLeftMethod().doc(),
+ "jboss:target-relation",
+ "fk-constraint",
+ null,
+ null,
+ false,
+ false
+ ) != null;
}
private boolean leftHasFK() throws XDocletException
{
- return DocletUtil.hasTag( currentRelation.getLeftMethod(),
"jboss:relation" );
+ return currentRelation.getLeftMethod().doc().hasTag( "jboss:relation"
);
}
private boolean rightHasFK() throws XDocletException
{
if( isBidirectional() )
{
- return DocletUtil.hasTag( currentRelation.getRightMethod(),
"jboss:relation" );
+ return currentRelation.getRightMethod().doc().hasTag(
"jboss:relation" );
}
else
{
- return DocletUtil.hasTag( currentRelation.getLeftMethod(),
"jboss:target-relation" );
+ return currentRelation.getLeftMethod().doc().hasTag(
"jboss:target-relation" );
}
}
private void forAllForeignKeys( String template, boolean left ) throws
XDocletException
{
- Tag[] fktags = null;
+ XTag[] fktags = null;
if( left )
{
- fktags = DocletUtil.getTagsByName(
currentRelation.getLeftMethod(), "jboss:relation" );
+ fktags = currentRelation.getLeftMethod().doc().tags(
"jboss:relation" );
}
else
{
if( isBidirectional() )
- fktags = DocletUtil.getTagsByName(
currentRelation.getRightMethod(), "jboss:relation" );
+ fktags = currentRelation.getRightMethod().doc().tags(
"jboss:relation" );
if( fktags == null )
- fktags = DocletUtil.getTagsByName(
currentRelation.getLeftMethod(), "jboss:target-relation" );
+ fktags = currentRelation.getLeftMethod().doc().tags(
"jboss:target-relation" );
}
//maybe we should throw here?
@@ -136,8 +184,8 @@
for( int i = 0; i < fktags.length; i++ )
{
- currentFKRelField = getParameterValue( fktags[i].text(),
"related-pk-field", 0 );
- currentFKCol = getParameterValue( fktags[i].text(),
"fk-column", 0 );
+ currentFKRelField = fktags[i].attributeValue(
"related-pk-field" );
+ currentFKCol = fktags[i].attributeValue( "fk-column" );
generate( template );
}
1.3.2.1 +17 -9 xdoclet/core/src/xdoclet/ejb/tags/vendor/JBossTagsHandler.java
Index: JBossTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/vendor/JBossTagsHandler.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -w -r1.3 -r1.3.2.1
--- JBossTagsHandler.java 12 Mar 2002 09:30:31 -0000 1.3
+++ JBossTagsHandler.java 16 Mar 2002 18:22:14 -0000 1.3.2.1
@@ -1,21 +1,24 @@
package xdoclet.ejb.tags.vendor;
+import xjavadoc.XJavaDoc;
+import xjavadoc.XClass;
+import xjavadoc.XMethod;
+import xjavadoc.XTag;
+import xjavadoc.XJavaDocException;
+
import org.apache.log4j.Category;
+
import xdoclet.XDocletException;
import xdoclet.util.Log;
-import xdoclet.util.DocletUtil;
+
import xdoclet.tags.ClassTagsHandler;
import java.util.Properties;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.Tag;
-
/**
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created October 18, 2001
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.2.1 $
*/
public class JBossTagsHandler extends ClassTagsHandler
{
@@ -47,13 +50,18 @@
public void ifHasDVC( String template ) throws XDocletException
{
boolean hasDVC = false;
- ClassDoc[] classes = getContext().getRoot().classes();
+ XClass[] classes = null;
+ try {
+ XJavaDoc.getInstance().sourceClasses();
+ } catch( XJavaDocException e ) {
+ throw new XDocletException( e, e.getMessage() );
+ }
for( int i = 0; i < classes.length; i++ )
{
- Tag[] dvc = DocletUtil.getTagsByName( classes[i], "jboss:dvc"
);
+ XTag dvc = classes[i].doc().tag( "jboss:dvc" );
- if( dvc != null && dvc.length > 0 )
+ if( dvc != null )
{
hasDVC = true;
break;
1.2.2.1 +6 -21 xdoclet/core/src/xdoclet/ejb/tags/vendor/MVCSoftTagsHandler.java
Index: MVCSoftTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/vendor/MVCSoftTagsHandler.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -w -r1.2 -r1.2.2.1
--- MVCSoftTagsHandler.java 6 Feb 2002 00:45:37 -0000 1.2
+++ MVCSoftTagsHandler.java 16 Mar 2002 18:22:14 -0000 1.2.2.1
@@ -1,13 +1,12 @@
package xdoclet.ejb.tags.vendor;
-import com.sun.javadoc.Parameter;
-import com.sun.javadoc.Tag;
+import xjavadoc.XParameter;
import org.apache.log4j.Category;
import xdoclet.XDocletException;
import xdoclet.tags.ClassTagsHandler;
-import xdoclet.util.DocletUtil;
+
import xdoclet.util.Log;
import xdoclet.util.Translator;
@@ -20,7 +19,7 @@
*/
public class MVCSoftTagsHandler extends ClassTagsHandler
{
- protected static Parameter currentQueryMethodParameter;
+ protected static XParameter currentQueryMethodParameter;
protected static StringTokenizer currentAliases;
protected static String currentRoleName;
protected static String currentFieldName;
@@ -28,12 +27,12 @@
public String methodParamType() throws XDocletException
{
- return currentQueryMethodParameter.type().toString();
+ return currentQueryMethodParameter.type().qualifiedName();
}
public void forAllQueryMethodParams( String template ) throws XDocletException
{
- Parameter[] parameters = getCurrentMethod().parameters();
+ XParameter[] parameters = getCurrentMethod().parameters();
for( int k = 0; k < ( parameters.length - 2 ); k++ )
{
@@ -168,21 +167,7 @@
private String getKeyAliases() throws XDocletException
{
- Tag[] tags = DocletUtil.getTagsByName( getCurrentMethod(),
"mvcsoft:relation" );
- Tag the_tag = null;
-
- if( tags != null && tags.length > 0 )
- {
- the_tag = tags[0];
- }
- if( the_tag == null )
- {
- return null;
- }
-
- String tag_value = DocletUtil.getText( the_tag );
-
- return getParameterValue( tag_value, "key-aliases", -1 );
+ return getCurrentMethod().doc().tagAttributeValue( "mvcsoft:relation",
"key-aliases", false );
}
private void doForExtendedRole( String token, String template ) throws
XDocletException
1.13.2.1 +26 -28
xdoclet/core/src/xdoclet/ejb/tags/vendor/StrutsFormTagsHandler.java
Index: StrutsFormTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/vendor/StrutsFormTagsHandler.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -w -r1.13 -r1.13.2.1
--- StrutsFormTagsHandler.java 4 Mar 2002 01:32:12 -0000 1.13
+++ StrutsFormTagsHandler.java 16 Mar 2002 18:22:14 -0000 1.13.2.1
@@ -6,7 +6,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Properties;
-import java.util.Vector;
+import java.util.ArrayList;
import xdoclet.XDocletTagSupport;
import xdoclet.DocletContext;
@@ -14,14 +14,14 @@
import xdoclet.ejb.EntityCmpSubTask;
import xdoclet.ejb.EntityPkSubTask;
import xdoclet.ejb.vendor.StrutsFormSubTask;
-import xdoclet.util.DocletUtil;
+
import xdoclet.ejb.tags.EjbTagsHandler;
import xdoclet.ejb.tags.PersistentTagsHandler;
import xdoclet.tags.MethodTagsHandler;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.MethodDoc;
-import com.sun.javadoc.Tag;
+import xjavadoc.XClass;
+import xjavadoc.XMethod;
+import xjavadoc.XTag;
import org.apache.log4j.Category;
import xdoclet.util.Log;
@@ -29,11 +29,11 @@
/**
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created Oct 19, 2001
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.13.2.1 $
*/
public class StrutsFormTagsHandler extends EjbTagsHandler
{
- public static String getStrutsFormClassFor( ClassDoc clazz ) throws
XDocletException
+ public static String getStrutsFormClassFor( XClass clazz ) throws
XDocletException
{
String packageName = clazz.containingPackage().name();
@@ -41,18 +41,19 @@
return packageName + '.' + getStrutsFormClassName( clazz );
}
- public static String getStrutsFormClassName( ClassDoc clazz ) throws
XDocletException
+ public static String getStrutsFormClassName( XClass clazz ) throws
XDocletException
{
- Tag currentTag = ( ( StrutsFormSubTask )
DocletContext.getInstance().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
+ XTag currentTag = ( ( StrutsFormSubTask )
DocletContext.getInstance().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
// check if there is a name parameter
- if( getParameterValue( clazz, DocletUtil.getText( currentTag ),
"name", 0 ) == null )
+ String name = currentTag.attributeValue( "name" );
+ if( name == null )
{
return getShortEjbNameFor( clazz ) + "Form";
}
else
{
- return MessageFormat.format( getStrutsFormClassPattern(), new
Object[]{getShortEjbNameFor( clazz ), getParameterValue( clazz, DocletUtil.getText(
currentTag ), "name", 0 )} );
+ return MessageFormat.format( getStrutsFormClassPattern(), new
Object[]{getShortEjbNameFor( clazz ), name } );
}
}
@@ -63,12 +64,9 @@
* @return whether class has struts:form tag defined
* @exception XDocletException Description of Exception
*/
- public static boolean hasFormDefinition( ClassDoc clazz ) throws
XDocletException
+ public static boolean hasFormDefinition( XClass clazz ) throws XDocletException
{
- if( DocletUtil.hasTag( clazz, "struts:form", false ) )
- return true;
- else
- return false;
+ return clazz.doc().hasTag( "struts:form", false );
}
protected static String getStrutsFormClassPattern()
@@ -93,8 +91,8 @@
*/
public String strutsFormName() throws XDocletException
{
- Tag currentTag = ( ( StrutsFormSubTask )
getDocletContext().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
- String formName = getParameterValue( DocletUtil.getText( currentTag ),
"name", 0 );
+ XTag currentTag = ( ( StrutsFormSubTask )
getDocletContext().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
+ String formName = currentTag.attributeValue( "name" );
if( formName == null || formName.trim().length() == 0 )
return Introspector.decapitalize( getEjbNameFor(
getCurrentClass() ) + "Form" );
@@ -117,7 +115,7 @@
// pk fields are included implicitly, unless include-pk="false" is
specified.
Category cat = Log.getCategory( StrutsFormTagsHandler.class,
"forAllFormFields" );
- ClassDoc cur_class = getCurrentClass();
+ XClass cur_class = getCurrentClass();
Map foundFields = new HashMap();
if( cat.isDebugEnabled() )
@@ -130,7 +128,7 @@
if( cat.isDebugEnabled() )
cat.debug( "-----CLASS=" + getCurrentClass().name() +
"----------------" );
- MethodDoc[] methods = getCurrentClass().methods();
+ XMethod[] methods = getCurrentClass().methods();
for( int j = 0; j < methods.length; j++ )
{
@@ -176,11 +174,11 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
*/
- protected boolean useMethodInForm( MethodDoc method ) throws XDocletException
+ protected boolean useMethodInForm( XMethod method ) throws XDocletException
{
// check for include-all
- Tag currentTag = ( ( StrutsFormSubTask )
getDocletContext().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
- String value = getParameterValue( DocletUtil.getText( currentTag ),
"include-all", 0 );
+ XTag currentTag = ( ( StrutsFormSubTask )
getDocletContext().getSubTaskBy( StrutsFormSubTask.SUBTASK_NAME )
).getCurrentFormTag();
+ String value = currentTag.attributeValue( "include-all" );
// by default, include all is true
if( value == null || value.trim().length() == 0 )
@@ -190,18 +188,18 @@
return true;
// include all pk fields unless include-pk="false"
- value = getParameterValue( DocletUtil.getText( currentTag ),
"include-pk", 0 );
+ value = currentTag.attributeValue( "include-pk" );
if( PersistentTagsHandler.isPkField( method ) && ( ( value == null )
|| ( value != null && !value.equals( "false" ) ) ) )
return true;
// check for explicit inclusion
- Tag[] mTags = DocletUtil.getTagsByName( method, "struts:form-field" );
+ XTag[] mTags = method.doc().tags( "struts:form-field" );
for( int i = 0; i < mTags.length; i++ )
{
- Tag mTag = mTags[i];
- String pname = getParameterValue( DocletUtil.getText( mTag ),
"form-name", 0 );
- String fname = getParameterValue( DocletUtil.getText(
currentTag ), "name", 0 );
+ XTag mTag = mTags[i];
+ String pname = mTag.attributeValue( "form-name" );
+ String fname = mTag.attributeValue( "name" );
if( pname != null && fname != null && fname.equals( pname ) )
return true;
1.7.2.1 +17 -18
xdoclet/core/src/xdoclet/ejb/tags/vendor/WeblogicRelationTagsHandler.java
Index: WeblogicRelationTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/tags/vendor/WeblogicRelationTagsHandler.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -w -r1.7 -r1.7.2.1
--- WeblogicRelationTagsHandler.java 6 Feb 2002 00:45:37 -0000 1.7
+++ WeblogicRelationTagsHandler.java 16 Mar 2002 18:22:14 -0000 1.7.2.1
@@ -4,15 +4,15 @@
import xdoclet.ejb.tags.RelationTagsHandler;
import xdoclet.XDocletException;
-import xdoclet.util.DocletUtil;
+
import xdoclet.util.Translator;
-import com.sun.javadoc.*;
+import xjavadoc.*;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
* @created Sept 11, 2001
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.7.2.1 $
*/
public class WeblogicRelationTagsHandler extends RelationTagsHandler
{
@@ -21,35 +21,35 @@
public void forAllLeftColumnMaps( String template ) throws XDocletException
{
- Tag[] columnMapTags = DocletUtil.getTagsByName(
currentRelation.getLeftMethod(), "weblogic:column-map" );
+ XTag[] columnMapTags = currentRelation.getLeftMethod().doc().tags(
"weblogic:column-map" );
for( int i = 0; i < columnMapTags.length; i++ )
{
- currentForeignKeyColumn = getParameterValue(
columnMapTags[i].text(), "foreign-key-column", 0 );
- currentKeyColumn = getParameterValue( columnMapTags[i].text(),
"key-column", 0 );
+ currentForeignKeyColumn = columnMapTags[i].attributeValue(
"foreign-key-column" );
+ currentKeyColumn = columnMapTags[i].attributeValue(
"key-column" );
generate( template );
}
}
public void forAllRightColumnMaps( String template ) throws XDocletException
{
- Tag[] columnMapTags = null;
+ XTag[] columnMapTags = null;
if( currentRelation.getRightMethod() != null )
{
// bidirectional
- columnMapTags = DocletUtil.getTagsByName(
currentRelation.getRightMethod(), "weblogic:column-map" );
+ columnMapTags = currentRelation.getRightMethod().doc().tags(
"weblogic:column-map" );
}
else
{
// unidirectional
- columnMapTags = DocletUtil.getTagsByName(
currentRelation.getLeftMethod(), "weblogic:target-column-map" );
+ columnMapTags = currentRelation.getRightMethod().doc().tags(
"weblogic:target-column-map" );
}
for( int i = 0; i < columnMapTags.length; i++ )
{
- currentForeignKeyColumn = getParameterValue(
columnMapTags[i].text(), "foreign-key-column", 0 );
- currentKeyColumn = getParameterValue( columnMapTags[i].text(),
"key-column", 0 );
+ currentForeignKeyColumn = columnMapTags[i].attributeValue(
"foreign-key-column" );
+ currentKeyColumn = columnMapTags[i].attributeValue(
"key-column" );
generate( template );
}
}
@@ -57,14 +57,14 @@
public String joinTableName() throws XDocletException
{
// We say mandatory is false (last parameter), so we can provide a
more detailed error message.
- String leftJoinTableName = getMethodTagValue(
currentRelation.getLeftMethod(), "weblogic:relation", "join-table-name", 0, null,
null, false );
+ String leftJoinTableName =
currentRelation.getLeftMethod().doc().tagAttributeValue( "weblogic:relation",
"join-table-name", false );
String joinTableName = leftJoinTableName;
String rightJoinTableName = null;
// do some sanity checking
if( leftJoinTableName == null && currentRelation.getRightMethod() !=
null )
{
- rightJoinTableName = getMethodTagValue(
currentRelation.getRightMethod(), "weblogic:relation", "join-table-name", 0, null,
null, false );
+ rightJoinTableName =
currentRelation.getRightMethod().doc().tagAttributeValue( "weblogic:relation",
"join-table-name", false );
joinTableName = rightJoinTableName;
}
if( leftJoinTableName != null && rightJoinTableName != null )
@@ -81,9 +81,7 @@
public String leftGroupName() throws XDocletException
{
- String groupName = getMethodTagValue( currentRelation.getLeftMethod(),
"weblogic:relation", "group-name", 0, null, null, false );
-
- return groupName;
+ return currentRelation.getLeftMethod().doc().tagAttributeValue(
"weblogic:relation", "group-name", false );
}
public void ifHasLeftGroupName( String template ) throws XDocletException
@@ -101,11 +99,12 @@
if( currentRelation.getRightMethod() != null )
{
// bidirectional
- groupName = getMethodTagValue(
currentRelation.getRightMethod(), "weblogic:relation", "group-name", 0, null, null,
false );
+ groupName =
currentRelation.getRightMethod().doc().tagAttributeValue( "weblogic:relation",
"group-name", false );
}
else
{
- groupName = getMethodTagValue(
currentRelation.getLeftMethod(), "weblogic:relation", "target-group-name", 0, null,
null, false );
+ // unidirectional
+ groupName =
currentRelation.getLeftMethod().doc().tagAttributeValue( "weblogic:relation",
"group-name", false );
}
return groupName;
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel