User: ara_e_w Date: 02/06/12 14:27:54 Modified: modules/ejb/src/xdoclet/modules/ejb/entity DataObjectTagsHandler.java PkTagsHandler.java ValueObjectTagsHandler.java Log: - remove ver-uid parameter of ejb:bean doc plus cleanup the code/templates - cleanup Revision Changes Path 1.5 +7 -100 xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/DataObjectTagsHandler.java Index: DataObjectTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/DataObjectTagsHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- DataObjectTagsHandler.java 31 May 2002 20:43:56 -0000 1.4 +++ DataObjectTagsHandler.java 12 Jun 2002 21:27:54 -0000 1.5 @@ -6,16 +6,12 @@ ////import xdoclet.util.serialveruid.*; -import java.beans.Introspector; -import java.lang.reflect.Modifier; import java.text.MessageFormat; import java.util.*; import org.apache.commons.logging.Log; import xjavadoc.XClass; -import xjavadoc.XDoc; -import xjavadoc.XField; import xjavadoc.XJavaDoc; import xjavadoc.XMethod; import xjavadoc.XParameter; @@ -23,11 +19,9 @@ import xdoclet.DocletTask; import xdoclet.XDocletException; -import xdoclet.XDocletTagSupport; import xdoclet.modules.ejb.EjbTagsHandler; import xdoclet.modules.ejb.XDocletModulesEjbMessages; import xdoclet.modules.ejb.entity.DataObjectSubTask; -import xdoclet.modules.ejb.entity.EntityBmpSubTask; import xdoclet.modules.ejb.intf.InterfaceTagsHandler; import xdoclet.tagshandler.MethodTagsHandler; import xdoclet.util.LogUtil; @@ -39,7 +33,7 @@ * @author Ara Abrahamian ([EMAIL PROTECTED]) * @created Oct 15, 2001 * @xdoclet:taghandler namespace="EjbDataObj" - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public class DataObjectTagsHandler extends EjbTagsHandler { @@ -171,9 +165,8 @@ * * @param clazz Description of Parameter * @return Description of the Returned Value - * @exception XDocletException */ - public static boolean isGenerationNeeded(XClass clazz) throws XDocletException + public static boolean isGenerationNeeded(XClass clazz) { if (isDataObjectSubTaskActive() == false) { return false; @@ -249,9 +242,8 @@ /** * @param clazz Description of Parameter * @return Description of the Returned Value - * @exception XDocletException */ - public static boolean hasCustomBulkData(XClass clazz) throws XDocletException + public static boolean hasCustomBulkData(XClass clazz) { Log log = LogUtil.getLog(DataObjectSubTask.class, "hasCustomBulkData"); @@ -575,25 +567,6 @@ } /** - * @return Description of the Returned Value - * @exception XDocletException - */ - public String serialVersionUID() throws XDocletException - { - return "007"; - /* - * int modifiers = Modifier.PUBLIC; - * String class_name = dataObjectClass(); - * int dot_pos = class_name.lastIndexOf( class_name ); - * String qualifier = class_name.substring( 0, dot_pos ); - * String name = class_name.substring( dot_pos ); - * java.util.List[] docs = extractDocs( class_name ); - * XClass XClass = new XClassImpl( modifiers, qualifier, name, docs[0], docs[1], docs[2] ); - * return Long.toString( SerialVersionUidGenerator.computeSerialVersionUID( XClass ) ) + "L"; - */ - } - - /** * Returns the name of the class dataobject class extends. * * @return The name of generated PK class. @@ -727,70 +700,4 @@ setCurrentClass(oldClass); } - /* - * private java.util.List[] extractDocs( String class_name ) throws XDocletException - * { - * Map foundFields = new HashMap(); - * java.util.List ext_fields = new java.util.ArrayList(); - * java.util.List ext_methods = new java.util.ArrayList(); - * java.util.List ext_constructors = new java.util.ArrayList(); - * XClass cur_class = getCurrentClass(); - * ArrayList full_constructor_params = new ArrayList(); - * do - * { - * XMethod[] methods = cur_class.methods(); - * for( int j = 0; j < methods.length; j++ ) - * { - * if( PersistentTagsHandler.isPersistentField( methods[j] ) && MethodTagsHandler.isGetter( methods[j].name() ) && !foundFields.containsKey( methods[j].name() ) ) - * { - * / Store that we found this field so we don't add it twice - * foundFields.put( methods[j].name(), methods[j].name() ); - * String method_name_without_prefix = MethodTagsHandler.getMethodNameWithoutPrefixFor( methods[j] ); - * String field_name = Introspector.decapitalize( method_name_without_prefix ); - * if( isAggregate( methods[j] ) ) - * { - * XField field = new XFieldImpl( field_name, Modifier.PROTECTED, new TypeImpl( methods[j].returnType().typeName() + "Data" ) ); - * ext_fields.add( field ); - * /getter method - * ext_methods.add( new XMethodImpl( methods[j].name(), Modifier.PUBLIC, new ParameterImpl[]{new ParameterImpl( new TypeImpl( methods[j].returnType().typeName() + "Data" ), field_name )}, methods[j].returnType() ) ); - * /setter method - * ext_methods.add( new XMethodImpl( "set" + method_name_without_prefix, Modifier.PUBLIC, new ParameterImpl[]{new ParameterImpl( new TypeImpl( methods[j].returnType().typeName() + "Data" ), field_name )}, new TypeImpl( "void" ) ) ); - * } - * else - * { - * XField field = new XFieldImpl( field_name, Modifier.PROTECTED, methods[j].returnType() ); - * ext_fields.add( field ); - * /getter method - * ext_methods.add( new XMethodImpl( methods[j].name(), Modifier.PUBLIC, new ParameterImpl[0], methods[j].returnType() ) ); - * /setter method - * ext_methods.add( new XMethodImpl( "set" + method_name_without_prefix, Modifier.PUBLIC, new ParameterImpl[]{new ParameterImpl( methods[j].returnType(), field_name )}, new TypeImpl( "void" ) ) ); - * } - * full_constructor_params.add( new ParameterImpl( methods[j].returnType(), field_name ) ); - * } - * } - * / Add super class info - * cur_class = cur_class.superclass(); - * }while ( cur_class != null ); - * /fields: - * int modifiers = Modifier.STATIC | Modifier.FINAL; - * ext_fields.add( new XFieldImpl( "serialVersionUID", modifiers, new TypeImpl( "long" ) ) ); - * if( BmpTagsHandler.useSoftLocking( getCurrentClass() ) ) - * ext_fields.add( new XFieldImpl( "_version", Modifier.PRIVATE, new TypeImpl( "long" ) ) ); - * /methods: - * if( hasDataEquals( getCurrentClass() ) ) - * ext_methods.add( new XMethodImpl( "equals", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "Object", "", getDocletContext().getRoot().classNamed( "java.lang.Object" ) ) ) ); - * ext_methods.add( new XMethodImpl( "toString", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "int" ) ) ); - * if( BmpTagsHandler.useSoftLocking( getCurrentClass() ) ) - * { - * ext_methods.add( new XMethodImpl( "getVersion", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "long" ) ) ); - * ext_methods.add( new XMethodImpl( "setVersion", Modifier.PUBLIC, new ParameterImpl[]{new ParameterImpl( new TypeImpl( "long" ), "version" )}, new TypeImpl( "void" ) ) ); - * } - * /constructors: - * modifiers = Modifier.PUBLIC; - * ext_constructors.add( new XConstructorImpl( class_name, modifiers, new ParameterImpl[0] ) ); - * ext_constructors.add( new XConstructorImpl( class_name, modifiers, new ParameterImpl[]{new ParameterImpl( new TypeImpl( class_name ), "otherData" )} ) ); - * ext_constructors.add( new XConstructorImpl( class_name, modifiers, ( ParameterImpl[] ) full_constructor_params.toArray( new ParameterImpl[0] ) ) ); - * return new java.util.List[]{ext_fields, ext_methods, ext_constructors}; - * } - */ } 1.5 +3 -80 xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/PkTagsHandler.java Index: PkTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/PkTagsHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- PkTagsHandler.java 10 Jun 2002 20:49:23 -0000 1.4 +++ PkTagsHandler.java 12 Jun 2002 21:27:54 -0000 1.5 @@ -6,17 +6,11 @@ //import xdoclet.util.serialveruid.*; -import java.beans.Introspector; -import java.lang.reflect.Modifier; import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; import java.util.StringTokenizer; import xjavadoc.XClass; -import xjavadoc.XField; import xjavadoc.XMethod; import xdoclet.DocletContext; import xdoclet.DocletTask; @@ -35,7 +29,7 @@ * @author Ara Abrahamian ([EMAIL PROTECTED]) * @created Oct 16, 2001 * @xdoclet:taghandler namespace="EjbPk" - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public class PkTagsHandler extends EjbTagsHandler { @@ -428,31 +422,11 @@ /** - * @return Description of the Returned Value - * @exception XDocletException - */ - public String serialVersionUID() throws XDocletException - { - return "007"; - /* - * int modifiers = Modifier.PUBLIC; - * String class_name = pkClass(); - * int dot_pos = class_name.lastIndexOf( class_name ); - * String qualifier = class_name.substring( 0, dot_pos ); - * String name = class_name.substring( dot_pos ); - * java.util.List[] docs = extractDocs( class_name ); - * XClass XClass = new XClassImpl( modifiers, qualifier, name, docs[0], docs[1], docs[2] ); - * return Long.toString( SerialVersionUidGenerator.computeSerialVersionUID( XClass ) ) + "L"; - */ - } - - - /** * Returns a string containing comma-separated list of primary key fields with their types. * * @return A string containing comma-separated list of primary key fields without their types. * @exception XDocletException - * @see src.xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String) + * @see xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String) * @doc:tag type="content" */ public String pkfieldList() throws XDocletException @@ -468,7 +442,7 @@ * @param attributes * @return A string containing comma-separated list of primary key fields without their types. * @exception XDocletException - * @see src.xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String) + * @see xdoclet.modules.ejb.entity.PersistentTagsHandler#fieldList(xjavadoc.XClass,java.lang.String,java.lang.String,int,java.lang.String) * @doc:tag type="content" */ public String pkfieldListFrom(Properties attributes) throws XDocletException @@ -531,55 +505,4 @@ { return getPkClassFor(clazz); } - - /* - * private java.util.List[] extractDocs( String class_name ) throws XDocletException - * { - * Map foundFields = new HashMap(); - * java.util.List ext_fields = new java.util.ArrayList(); - * java.util.List ext_methods = new java.util.ArrayList(); - * java.util.List ext_constructors = new java.util.ArrayList(); - * XClass cur_class = getCurrentClass(); - * ArrayList full_constructor_params = new ArrayList(); - * do - * { - * XMethod[] methods = cur_class.methods(); - * for( int j = 0; j < methods.length; j++ ) - * { - * if( PersistentTagsHandler.isPersistentField( methods[j] ) && MethodTagsHandler.isGetter( methods[j].name() ) && !foundFields.containsKey( methods[j].name() ) ) - * { - * / Store that we found this field so we don't add it twice - * foundFields.put( methods[j].name(), methods[j].name() ); - * int modifiers = Modifier.PUBLIC; - * String field_name = Introspector.decapitalize( MethodTagsHandler.getMethodNameWithoutPrefixFor( methods[j] ) ); - * XField field = new XFieldImpl( field_name, modifiers, methods[j].returnType() ); - * ext_fields.add( field ); - * /getter method - * ext_methods.add( new XMethodImpl( methods[j].name(), Modifier.PUBLIC, new ParameterImpl[0], methods[j].returnType() ) ); - * } - * else if( PersistentTagsHandler.isPkField( methods[j] ) && MethodTagsHandler.isGetter( methods[j].name() ) ) - * { - * String field_name = Introspector.decapitalize( MethodTagsHandler.getMethodNameWithoutPrefixFor( methods[j] ) ); - * full_constructor_params.add( new ParameterImpl( methods[j].returnType(), field_name ) ); - * } - * } - * / Add super class info - * cur_class = cur_class.superclass(); - * }while ( cur_class != null ); - * int modifiers = Modifier.STATIC | Modifier.FINAL; - * ext_fields.add( new XFieldImpl( "serialVersionUID", modifiers, new TypeImpl( "long" ) ) ); - * modifiers = Modifier.TRANSIENT | Modifier.PRIVATE; - * ext_fields.add( new XFieldImpl( "_hashCode", modifiers, new TypeImpl( "int" ) ) ); - * modifiers = Modifier.TRANSIENT | Modifier.PRIVATE; - * ext_fields.add( new XFieldImpl( "value", modifiers, new TypeImpl( "String" ) ) ); - * ext_methods.add( new XMethodImpl( "hashcode", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "int" ) ) ); - * ext_methods.add( new XMethodImpl( "equals", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "Object", "", getDocletContext().getRoot().classNamed( "java.lang.Object" ) ) ) ); - * ext_methods.add( new XMethodImpl( "toString", Modifier.PUBLIC, new ParameterImpl[0], new TypeImpl( "int" ) ) ); - * /constructors: - * modifiers = Modifier.PUBLIC; - * ext_constructors.add( new XConstructorImpl( class_name, modifiers, new ParameterImpl[0] ) ); - * ext_constructors.add( new XConstructorImpl( class_name, modifiers, ( ParameterImpl[] ) full_constructor_params.toArray( new ParameterImpl[0] ) ) ); - * return new java.util.List[]{ext_fields, ext_methods, ext_constructors}; - * } - */ } 1.5 +9 -52 xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java Index: ValueObjectTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- ValueObjectTagsHandler.java 12 Jun 2002 09:12:55 -0000 1.4 +++ ValueObjectTagsHandler.java 12 Jun 2002 21:27:54 -0000 1.5 @@ -4,31 +4,21 @@ */ package xdoclet.modules.ejb.entity; -import java.beans.Introspector; -import java.lang.reflect.Modifier; - import java.text.MessageFormat; -import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.Set; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import xjavadoc.XClass; -import xjavadoc.XField; import xjavadoc.XMethod; import xjavadoc.XTag; import xdoclet.DocletContext; import xdoclet.DocletTask; import xdoclet.XDocletException; -import xdoclet.XDocletTagSupport; import xdoclet.modules.ejb.EjbTagsHandler; import xdoclet.modules.ejb.entity.ValueObjectSubTask; import xdoclet.modules.ejb.intf.InterfaceTagsHandler; @@ -41,7 +31,7 @@ * @author Vincent Harcq ([EMAIL PROTECTED]) * @created Feb 5, 2002 * @xdoclet:taghandler namespace="EjbValueObj" - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public class ValueObjectTagsHandler extends EjbTagsHandler @@ -59,20 +49,16 @@ private String currentAggregateName; - private String currentIsCollection; - private String currentRelationBeanClass; /** * Checks if a method is a value object relation (aggregate or compose) matching a certain valueObject * - * @param clazz * @param method * @param valueObject * @return - * @exception XDocletException */ - public static boolean isValueObjectRelation(XClass clazz, XMethod method, String valueObject) throws XDocletException + public static boolean isValueObjectRelation(XMethod method, String valueObject) { Log log = LogUtil.getLog(ValueObjectTagsHandler.class, "isValueObjectRelation"); boolean ret = method.getDoc().hasTag("ejb:value-object"); @@ -173,10 +159,8 @@ * * @param tag Describe what the parameter does * @return The CurrentValueObjectName value - * @exception XDocletException */ public static String getCurrentValueObjectName(XTag tag) - throws XDocletException { return tag.getAttributeValue("name"); } @@ -186,10 +170,8 @@ * * @param tag Describe what the parameter does * @return The CurrentValueObjectAttribute value - * @exception XDocletException */ public static String getCurrentValueObjectAttribute(XTag tag) - throws XDocletException { String name = tag.getAttributeValue("name"); @@ -210,10 +192,8 @@ * * @param tag Describe what the parameter does * @return The CurrentValueObjectMatch value - * @exception XDocletException */ public static String getCurrentValueObjectMatch(XTag tag) - throws XDocletException { String match = tag.getAttributeValue("match"); @@ -269,25 +249,6 @@ } /** - * @return Description of the Returned Value - * @exception XDocletException - */ - public String serialVersionUID() throws XDocletException - { - return "007"; - /* - * int modifiers = Modifier.PUBLIC; - * String class_name = valueObjectClass(); - * int dot_pos = class_name.lastIndexOf( class_name ); - * String qualifier = class_name.substring( 0, dot_pos ); - * String name = class_name.substring( dot_pos ); - * java.util.List[] docs = extractDocs( class_name ); - * XClass XClass = new XClassImpl( modifiers, qualifier, name, docs[0], docs[1], docs[2] ); - * return Long.toString( SerialVersionUidGenerator.computeSerialVersionUID( XClass ) ) + "L"; - */ - } - - /** * Describe what the method does * * @return Describe the return value @@ -454,7 +415,6 @@ public void forAllSuperSetValue(String template) throws XDocletException { XClass oldClass = getCurrentClass(); - List already = new ArrayList(); do { XTag[] dos = getCurrentClass().getDoc().getTags("ejb:value-object", false); @@ -673,7 +633,7 @@ if (MethodTagsHandler.isGetter(getCurrentMethod().getName()) && !foundFields.containsKey(getCurrentMethod().getName()) && - isValueObjectRelation(getCurrentClass(), getCurrentMethod(), valueObject)) { + isValueObjectRelation(getCurrentMethod(), valueObject)) { boolean ret = getCurrentMethod().getDoc().hasTag("ejb:value-object"); @@ -703,7 +663,6 @@ } currentAggregateType = aggreg; currentAggregateName = aggregName; - currentIsCollection = "true"; String relationInterface = tags[i].getAttributeValue("members"); @@ -720,13 +679,11 @@ } currentAggregateType = aggreg; currentAggregateName = aggregName; - currentIsCollection = "false"; currentRelationBeanClass = InterfaceTagsHandler.getBeanClassNameFromInterfaceNameFor(getCurrentMethod().getReturnType().toString()); } generate(template); currentAggregateType = null; currentAggregateName = null; - currentIsCollection = null; currentRelationBeanClass = null; break; }
_______________________________________________________________ Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel