Update of /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31755/modules/jdo/src/xdoclet/modules/jdo
Modified Files: JdoObjectIdGeneratorTagsHandler.java JdoObjectIdGeneratorSubTask.java Log Message: objectid-classes can now implement interfaces or extend a superclass Index: JdoObjectIdGeneratorTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo/JdoObjectIdGeneratorTagsHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** JdoObjectIdGeneratorTagsHandler.java 29 Aug 2005 21:36:09 -0000 1.2 --- JdoObjectIdGeneratorTagsHandler.java 29 Aug 2005 22:42:46 -0000 1.3 *************** *** 241,252 **** } public String code(Properties attributes) throws XDocletException { return getCurrentClass().getDoc().getTagAttributeValue("jdo.create-objectid-class", "code"); - // - // if (res == null) - // res = ""; - // - // return res; } --- 241,301 ---- } + /** + * @param attributes + * @return Returns either <tt>null</tt> or a String in the form " extends a.b.Class". + * @exception XDocletException + */ + public String superclass(Properties attributes) throws XDocletException + { + String res = ((JdoObjectIdGeneratorSubTask) getDocletContext().getSubTaskBy("jdoobjectidgenerator")).getSuperclass(); + + XDoc classDoc = getCurrentClass().getDoc(); + String superclass = classDoc.getTagAttributeValue("jdo.create-objectid-class", "superclass"); + + if (superclass != null) + res = superclass; + + if (res != null && !"".equals(res)) + res = " extends " + res; + return res; + } + + /** + * @param attributes + * @return Returns <tt>null</tt> or all interfaces that shall be implemented (comma-separated). + * @exception XDocletException + */ + public String interfaces(Properties attributes) throws XDocletException + { + String res = ((JdoObjectIdGeneratorSubTask) getDocletContext().getSubTaskBy("jdoobjectidgenerator")).getInterfaces(); + + XDoc classDoc = getCurrentClass().getDoc(); + String addInterfaces = classDoc.getTagAttributeValue("jdo.create-objectid-class", "add-interfaces"); + + if (res != null && addInterfaces != null) + res = res + ", " + addInterfaces; + else if (addInterfaces != null) + res = addInterfaces; + + String replaceInterfaces = classDoc.getTagAttributeValue("jdo.create-objectid-class", "replace-interfaces"); + + if (replaceInterfaces != null) + res = replaceInterfaces; + + if (res != null && !"".equals(res)) + res = ", " + res; + return res; + } + + /** + * Additional code can be pasted into the objectid-class. + * + * @param attributes + * @return + * @exception XDocletException + */ public String code(Properties attributes) throws XDocletException { return getCurrentClass().getDoc().getTagAttributeValue("jdo.create-objectid-class", "code"); } Index: JdoObjectIdGeneratorSubTask.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo/JdoObjectIdGeneratorSubTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** JdoObjectIdGeneratorSubTask.java 29 Aug 2005 20:28:51 -0000 1.1 --- JdoObjectIdGeneratorSubTask.java 29 Aug 2005 22:42:46 -0000 1.2 *************** *** 27,30 **** --- 27,34 ---- protected final static String DEFAULT_TEMPLATE_FILE = "resources/java_objectid.xdt"; + private String interfaces = null; + + private String superclass = null; + public JdoObjectIdGeneratorSubTask() { *************** *** 40,43 **** --- 44,67 ---- } + public String getInterfaces() + { + return interfaces; + } + + public String getSuperclass() + { + return superclass; + } + + public void setInterfaces(String interfaces) + { + this.interfaces = interfaces; + } + + public void setSuperclass(String superClass) + { + this.superclass = superClass; + } + protected String getGeneratedFileName(XClass clazz) throws XDocletException ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel