Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/xdoclet/secure/ViewIssue.jspa?key=XDT-240 Here is an overview of the issue: --------------------------------------------------------------------- Key: XDT-240 Summary: Additional method tags to allow conditional templating depending on what exceptions a method throws Type: Improvement Status: Assigned Priority: Major Time Spent: Unknown Estimate: 0 minutes Project: XDoclet Component: Core Versions: 1.2 Beta 2 Assignee: xdoclet-devel (Use for new issues) Reporter: Shaun Kelly Created: Wed, 8 Jan 2003 12:51 PM Updated: Wed, 8 Jan 2003 12:51 PM Environment: Windows XP, Sun JDK1.4.1 Description: Can the following two tags be added to \core\src\xdoclet\tagshandler\MethodTagsHandler.java. These tags allow conditional templating depending on what exceptions a method throws /** * Evaluate the body block if current method throws the excpetion specified in the exception attribute. * * @param template The body of the block tag * @param attributes The attributes of the template tag * @exception XDocletException Description of Exception * @see #ifDoesntThrowException(java.lang.String,java.util.Properties) * @doc.tag type="block" * @doc.param name="method" optional="true" description="The method name whose return type is * checked. If not specified then current method is used." * @doc.param name="exceptions" optional="false" description="The exception name which is checked * for" */ public void ifThrowException(String template, Properties attributes) throws XDocletException { String checkExceptions = attributes.getProperty("exceptions"); String memberName = null; Collection exceptions = null; XExecutableMember executableMember = null; executableMember = getCurrentMethod(); memberName = attributes.getProperty("method"); if (executableMember == null && memberName == null) { exceptions = new ArrayList(); } if (memberName == null) { exceptions = executableMember.getThrownExceptions(); } else { executableMember = getXExecutableMemberForMemberName(memberName, true, FOR_METHOD); // no member with the specified name found in class if (executableMember != null) { exceptions = executableMember.getThrownExceptions(); } else { exceptions = new ArrayList(); } } String type = null; for (Iterator i = exceptions.iterator(); i.hasNext(); ) { type = ((XClass) i.next()).getQualifiedName(); if (checkExceptions != null) { if (checkExceptions.indexOf(type) != -1) { generate(template); } } } } /** * Evaluate the body block if current method doesn't throw the an excpetion specified in the exception attribute. * * @param template The body of the block tag * @param attributes The attributes of the template tag * @exception XDocletException Description of Exception * @see #ifThrowException(java.lang.String,java.util.Properties) * @doc.tag type="block" * @doc.param name="method" optional="true" description="The method name whose return type is * checked. If not specified then current method is used." * @doc.param name="exception" optional="false" description="The exception name which is checked * for" */ public void ifDoesntThrowException(String template, Properties attributes) throws XDocletException { String checkExceptions = attributes.getProperty("exceptions"); String memberName = null; Collection exceptions = null; XExecutableMember executableMember = null; executableMember = getCurrentMethod(); memberName = attributes.getProperty("method"); if (executableMember == null && memberName == null) { exceptions = new ArrayList(); } if (memberName == null) { exceptions = executableMember.getThrownExceptions(); } else { executableMember = getXExecutableMemberForMemberName(memberName, true, FOR_METHOD); // no member with the specified name found in class if (executableMember != null) { exceptions = executableMember.getThrownExceptions(); } else { exceptions = new ArrayList(); } } String type = null; for (Iterator i = exceptions.iterator(); i.hasNext(); ) { type = ((XClass) i.next()).getQualifiedName(); if (checkExceptions != null) { if (checkExceptions.indexOf(type) == -1) { generate(template); } } } } --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
